r66436 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66435‎ | r66436 | r66437 >
Date:19:47, 14 May 2010
Author:aaron
Status:ok
Tags:
Comment:
* Show the tags for each page at ProblemChanges
* Minor cleanups
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ProblemChanges_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -213,8 +213,9 @@
214214 'diff=cur&oldid='.intval($row->stable).'&diffonly=0' );
215215 # Show quality level if there are several
216216 if ( FlaggedRevs::qualityVersions() ) {
217 - $quality = $row->quality ?
218 - wfMsgHtml( 'revreview-lev-quality' ) : wfMsgHtml( 'revreview-lev-basic' );
 217+ $quality = $row->quality
 218+ ? wfMsgHtml( 'revreview-lev-quality' )
 219+ : wfMsgHtml( 'revreview-lev-basic' );
219220 $quality = " <b>[{$quality}]</b>";
220221 }
221222 # Is anybody watching?
Index: trunk/extensions/FlaggedRevs/specialpages/ProblemChanges_body.php
@@ -173,19 +173,26 @@
174174
175175 public function formatRow( $row ) {
176176 global $wgLang, $wgUser, $wgMemc;
177 -
178 - $css = $stxt = $quality = $underReview = '';
179 - $title = Title::makeTitle( $row->page_namespace, $row->page_title );
 177+ $css = $quality = $tags = $underReview = '';
 178+
 179+ $title = Title::newFromRow( $row );
180180 $link = $this->skin->makeKnownLinkObj( $title );
181181 $review = $this->skin->makeKnownLinkObj( $title,
182182 wfMsg( 'oldreviewed-diff' ),
183 - 'diff=cur&oldid='.intval($row->stable).'&diffonly=0' );
 183+ 'diff=cur&oldid=' . intval($row->stable) . '&diffonly=0' );
184184 # Show quality level if there are several
185185 if ( FlaggedRevs::qualityVersions() ) {
186 - $quality = $row->quality ?
187 - wfMsgHtml( 'revreview-lev-quality' ) : wfMsgHtml( 'revreview-lev-basic' );
 186+ $quality = $row->quality
 187+ ? wfMsgHtml( 'revreview-lev-quality' )
 188+ : wfMsgHtml( 'revreview-lev-basic' );
188189 $quality = " <b>[{$quality}]</b>";
189190 }
 191+ # What are the tags?
 192+ $dbTags = self::getRevisionTags( $title->getArticleID(), $row->stable );
 193+ if ( $dbTags ) {
 194+ $tags = htmlspecialchars( implode( ', ', $dbTags ) );
 195+ $tags = ' <b>' . wfMsgHtml( 'parentheses', $tags ) . '</b>';
 196+ }
190197 # Is anybody watching?
191198 if ( !$this->including() && $wgUser->isAllowed( 'unreviewedpages' ) ) {
192199 $uw = UnreviewedPages::usersWatching( $title );
@@ -222,32 +229,34 @@
223230 }
224231 $key = wfMemcKey( 'stableDiffs', 'underReview', $row->stable, $row->page_latest );
225232 # Show if a user is looking at this page
226 - if ( ( $val = $wgMemc->get( $key ) ) ) {
227 - $underReview = " <b class='fr-under-review'>" .
228 - wfMsgHtml( 'oldreviewedpages-viewing' ) . '</b>';
 233+ if ( $wgMemc->get( $key ) ) {
 234+ $underReview = ' <span class="fr-under-review">' .
 235+ wfMsgHtml( 'oldreviewedpages-viewing' ) . '</span>';
229236 }
230237
231 - return( "<li{$css}>{$link} {$stxt} ({$review}) <i>{$age}</i>" .
232 - "{$quality}{$watching}{$underReview}</li>" );
 238+ return( "<li{$css}>{$link} ({$review}) <i>{$age}</i>" .
 239+ "{$quality}{$tags}{$watching}{$underReview}</li>" );
233240 }
234241
235242 /**
236 - * Get the timestamp of the next revision
237 - *
238 - * @param integer $revision Revision ID. Get the revision that was after this one.
239 - * @param integer $page, page ID
 243+ * Get the tags of the revisions of a page after a certain rev
 244+ * @param integer $pageId, page ID
 245+ * @param integer $revId, rev ID
240246 */
241 - protected function getNextRevisionTimestamp( $revision, $page ) {
 247+ protected static function getRevisionTags( $pageId, $revId ) {
 248+ $tags = array();
242249 $dbr = wfGetDB( DB_SLAVE );
243 -
244 - return $dbr->selectField( 'revision', 'rev_timestamp',
245 - array(
246 - 'rev_page' => $page,
247 - 'rev_id > ' . intval( $revision )
248 - ),
249 - __METHOD__,
250 - array( 'ORDER BY' => 'rev_id' )
 250+ $res = $dbr->select(
 251+ array( 'revision', 'change_tag' ),
 252+ 'DISTINCT(ct_tag)', // unique tags
 253+ array( 'rev_page' => $pageId, 'rev_id > ' . intval($revId),
 254+ 'rev_id = ct_rev_id' ),
 255+ __METHOD__
251256 );
 257+ foreach( $res as $row ) {
 258+ $tags[] = $row->ct_tag;
 259+ }
 260+ return $tags;
252261 }
253262
254263 protected static function getLineClass( $hours, $uw ) {
@@ -293,7 +302,8 @@
294303 $conds = $this->mConds;
295304 $tables = array( 'revision', 'change_tag', 'page' );
296305 $fields = array( 'page_namespace' , 'page_title', 'page_latest' );
297 - $ctIndex = $wgOldChangeTagsIndex ? 'ct_rev_id' : 'change_tag_rev_tag';
 306+ $ctIndex = $wgOldChangeTagsIndex ?
 307+ 'ct_rev_id' : 'change_tag_rev_tag';
298308 # Show outdated "stable" pages
299309 if ( $this->level < 0 ) {
300310 $fields[] = 'fp_stable AS stable';
@@ -308,7 +318,8 @@
309319 $conds['ct_tag'] = $this->tag;
310320 }
311321 $conds[] = 'page_id = fp_page_id';
312 - $useIndex = array( 'flaggedpages' => 'fp_pending_since', 'change_tag' => $ctIndex );
 322+ $useIndex = array(
 323+ 'flaggedpages' => 'fp_pending_since', 'change_tag' => $ctIndex );
313324 # Filter by category
314325 if ( $this->category != '' ) {
315326 array_unshift( $tables, 'categorylinks' ); // order matters
@@ -331,8 +342,8 @@
332343 $conds[] = 'rev_id > fpp_rev_id';
333344 $conds[] = 'rev_id = ct_rev_id';
334345 $conds['ct_tag'] = $this->tag;
335 - $useIndex = array( 'flaggedpage_pending' => 'fpp_quality_pending',
336 - 'change_tag' => $ctIndex );
 346+ $useIndex = array(
 347+ 'flaggedpage_pending' => 'fpp_quality_pending', 'change_tag' => $ctIndex );
337348 # Filter by review level
338349 $conds['fpp_quality'] = $this->level;
339350 # Filter by category

Status & tagging log