r34635 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34634‎ | r34635 | r34636 >
Date:01:46, 12 May 2008
Author:aaron
Status:old
Tags:
Comment:
OOP
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -286,6 +286,8 @@
287287 return true;
288288 # Initialize and set article hooks
289289 $wgFlaggedArticle = new FlaggedArticle( $title );
 290+ # Set image version
 291+ $wgFlaggedArticle->setImageVersion();
290292 # Main hooks, overrides pages content, adds tags, sets tabs and permalink
291293 $wgHooks['SkinTemplateTabs'][] = array( $wgFlaggedArticle, 'setActionTabs' );
292294 # Change last-modified footer
@@ -294,8 +296,6 @@
295297 $wgHooks['ArticleViewHeader'][] = array( $wgFlaggedArticle, 'maybeUpdateMainCache' );
296298 $wgHooks['ArticleViewHeader'][] = array( $wgFlaggedArticle, 'setPageContent' );
297299 $wgHooks['ArticleViewHeader'][] = array( $wgFlaggedArticle, 'addPatrolLink' );
298 - # Set image version
299 - $wgHooks['ArticleFromTitle'][] = array( $wgFlaggedArticle, 'setImageVersion' );
300300 # Add page notice
301301 $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = array( $wgFlaggedArticle, 'setPermaLink' );
302302 # Add tags do edit view
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -359,24 +359,24 @@
360360 /**
361361 * Set the image revision to display
362362 */
363 - public static function setImageVersion( $title, $article ) {
364 - if( $title->getNamespace() == NS_IMAGE && FlaggedRevs::isPageReviewable( $title ) ) {
365 - global $wgFlaggedArticle, $wgRequest;
 363+ public function setImageVersion() {
 364+ if( $this->getTitle()->getNamespace() == NS_IMAGE && $this->isReviewable() ) {
 365+ global $wgRequest;
366366 # A reviewed version may have explicitly been requested...
367367 $frev = null;
368368 if( $reqId = $wgRequest->getVal('stableid') ) {
369 - $frev = FlaggedRevs::getFlaggedRev( $title, $reqId );
370 - } else if( $wgFlaggedArticle->pageOverride() ) {
371 - $frev = $wgFlaggedArticle->getStableRev( true );
 369+ $frev = FlaggedRevs::getFlaggedRev( $this->getTitle(), $reqId );
 370+ } else if( $this->pageOverride() ) {
 371+ $frev = $this->getStableRev( true );
372372 }
373373 if( !is_null($frev) ) {
374374 $dbr = wfGetDB( DB_SLAVE );
375375 $time = $dbr->selectField( 'flaggedimages', 'fi_img_timestamp',
376376 array( 'fi_rev_id' => $frev->getRevId(),
377 - 'fi_name' => $title->getDBkey() ),
 377+ 'fi_name' => $this->getTitle()->getDBkey() ),
378378 __METHOD__ );
379379 # NOTE: if not found, this will use the current
380 - $article = new ImagePage( $title, $time );
 380+ $article = new ImagePage( $this->getTitle(), $time );
381381 }
382382 }
383383 return true;

Status & tagging log