r34207 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34206‎ | r34207 | r34208 >
Date:15:00, 4 May 2008
Author:aaron
Status:old
Tags:
Comment:
Fix query
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php
@@ -895,10 +895,18 @@
896896 else
897897 $stxt = ' <small>' . wfMsgHtml('historysize', $wgLang->formatNum( $size ) ) . '</small>';
898898 }
899 - $unwatched = is_null($result->wl_user) ? wfMsgHtml("unreviewed-unwatched") : "";
 899+ $unwatched = !self::isWatched( $title ) ? " ".wfMsgHtml("unreviewed-unwatched") : "";
900900
901901 return( "<li>{$link} {$stxt} {$review}{$unwatched}</li>" );
902902 }
 903+
 904+ public static function isWatched( $title ) {
 905+ $dbr = wfGetDB( DB_SLAVE );
 906+ $watched = $dbr->selectRow( 'watchlist', '1',
 907+ array( 'wl_namespace' => $title->getNamespace(), 'wl_title' => $title->getDBKey() ),
 908+ __METHOD__ );
 909+ return $watched;
 910+ }
903911 }
904912
905913 /**
@@ -985,8 +993,7 @@
986994 }
987995 $options['LIMIT'] = intval( $limit );
988996 # Get table names
989 - list($flaggedpages,$page,$categorylinks,$watchlist) =
990 - $this->mDb->tableNamesN('flaggedpages','page','categorylinks','watchlist');
 997+ list($flaggedpages,$page,$categorylinks) = $this->mDb->tableNamesN('flaggedpages','page','categorylinks');
991998 # Are we filtering via category?
992999 if( in_array('categorylinks',$tables) ) {
9931000 $index = $this->mDb->useIndexClause('cl_sortkey'); // *sigh*...
@@ -995,11 +1002,9 @@
9961003 $index = $this->mDb->useIndexClause('name_title'); // *sigh*...
9971004 $fromClause = "$page $index";
9981005 }
999 - $fields[] = 'wl_user';
10001006 $sql = "SELECT ".implode(',',$fields).
10011007 " FROM $fromClause".
10021008 " LEFT JOIN $flaggedpages ON (fp_page_id=page_id)".
1003 - " LEFT JOIN $watchlist ON (wl_namespace=page_namespace AND wl_title=page_title)".
10041009 " WHERE ".$this->mDb->makeList($conds,LIST_AND).
10051010 " ORDER BY ".$options['ORDER BY']." LIMIT ".$options['LIMIT'];
10061011 # Do query!
@@ -1081,8 +1086,10 @@
10821087 $hist = $this->skin->makeKnownLinkObj( $title, wfMsg('hist'),
10831088 "action=history" );
10841089 $quality = $result->fp_quality ? wfMsgHtml('oldreviewedpages-quality') : wfMsgHtml('oldreviewedpages-stable');
 1090+
 1091+ $unwatched = !UnreviewedPages::isWatched( $title ) ? " ".wfMsgHtml("unreviewed-unwatched") : "";
10851092
1086 - return( "<li>{$link} {$stxt} ({$review}) ({$hist}) <strong>[{$quality}]</strong></li>" );
 1093+ return( "<li>{$link} {$stxt} ({$review}) ({$hist}) <strong>[{$quality}]</strong>{$unwatched}</li>" );
10871094 }
10881095 }
10891096

Status & tagging log