r34668 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34667‎ | r34668 | r34669 >
Date:16:32, 12 May 2008
Author:aaron
Status:old
Tags:
Comment:
* Deal with crappy articleFromTitle() use in wiki.php
* Add wfdebug calls to be clean
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -282,12 +282,18 @@
283283
284284 function wfInitFlaggedArticle( $title, $article ) {
285285 global $wgFlaggedArticle, $wgHooks;
286 - if( !FlaggedRevs::isPageReviewable( $title ) )
 286+ if( $title->isRedirect() || !FlaggedRevs::isPageReviewable($title) )
287287 return true;
288288 # Initialize and set article hooks
289289 $wgFlaggedArticle = new FlaggedArticle( $title );
290290 # Set image version
291291 $wgFlaggedArticle->setImageVersion();
 292+ # Always prevent hooks from doubling up
 293+ if( FlaggedRevs::$articleLoaded ) {
 294+ wfDebug( 'Warning - $wgFlaggedArticle already loaded!' );
 295+ return true;
 296+ }
 297+ FlaggedRevs::$articleLoaded = true;
292298 # Main hooks, overrides pages content, adds tags, sets tabs and permalink
293299 $wgHooks['SkinTemplateTabs'][] = array( $wgFlaggedArticle, 'setActionTabs' );
294300 # Change last-modified footer
@@ -340,6 +346,7 @@
341347 class FlaggedRevs {
342348 public static $dimensions = array();
343349 public static $styleLoaded = false;
 350+ public static $articleLoaded = false;
344351
345352 public static function load() {
346353 global $wgFlaggedRevTags, $wgFlaggedRevValues;
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -93,7 +93,7 @@
9494 */
9595 public function setPageContent( $article, &$outputDone, &$pcache ) {
9696 global $wgRequest, $wgOut, $wgUser, $wgLang;
97 - ## Only trigger for reviewable pages
 97+ # Only trigger for reviewable pages
9898 if( !FlaggedRevs::isPageReviewable( $article->getTitle() ) ) {
9999 return true;
100100 }

Status & tagging log