Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -286,6 +286,8 @@ |
287 | 287 | return true; |
288 | 288 | # Initialize and set article hooks |
289 | 289 | $wgFlaggedArticle = new FlaggedArticle( $title ); |
| 290 | + # Set image version |
| 291 | + $wgFlaggedArticle->setImageVersion(); |
290 | 292 | # Main hooks, overrides pages content, adds tags, sets tabs and permalink |
291 | 293 | $wgHooks['SkinTemplateTabs'][] = array( $wgFlaggedArticle, 'setActionTabs' ); |
292 | 294 | # Change last-modified footer |
— | — | @@ -294,8 +296,6 @@ |
295 | 297 | $wgHooks['ArticleViewHeader'][] = array( $wgFlaggedArticle, 'maybeUpdateMainCache' ); |
296 | 298 | $wgHooks['ArticleViewHeader'][] = array( $wgFlaggedArticle, 'setPageContent' ); |
297 | 299 | $wgHooks['ArticleViewHeader'][] = array( $wgFlaggedArticle, 'addPatrolLink' ); |
298 | | - # Set image version |
299 | | - $wgHooks['ArticleFromTitle'][] = array( $wgFlaggedArticle, 'setImageVersion' ); |
300 | 300 | # Add page notice |
301 | 301 | $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = array( $wgFlaggedArticle, 'setPermaLink' ); |
302 | 302 | # Add tags do edit view |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -359,24 +359,24 @@ |
360 | 360 | /** |
361 | 361 | * Set the image revision to display |
362 | 362 | */ |
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; |
366 | 366 | # A reviewed version may have explicitly been requested... |
367 | 367 | $frev = null; |
368 | 368 | 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 ); |
372 | 372 | } |
373 | 373 | if( !is_null($frev) ) { |
374 | 374 | $dbr = wfGetDB( DB_SLAVE ); |
375 | 375 | $time = $dbr->selectField( 'flaggedimages', 'fi_img_timestamp', |
376 | 376 | array( 'fi_rev_id' => $frev->getRevId(), |
377 | | - 'fi_name' => $title->getDBkey() ), |
| 377 | + 'fi_name' => $this->getTitle()->getDBkey() ), |
378 | 378 | __METHOD__ ); |
379 | 379 | # NOTE: if not found, this will use the current |
380 | | - $article = new ImagePage( $title, $time ); |
| 380 | + $article = new ImagePage( $this->getTitle(), $time ); |
381 | 381 | } |
382 | 382 | } |
383 | 383 | return true; |