r44892 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44891‎ | r44892 | r44893 >
Date:07:35, 22 December 2008
Author:aaron
Status:ok
Tags:
Comment:
Avoid extra page_touched query
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -753,6 +753,7 @@
754754 $request: WebRequest
755755 $ignoreRedirect: boolean to skip redirect check
756756 $target: Title/string of redirect target
 757+$article: Article object
757758
758759 'InitPreferencesForm': called at the end of PreferencesForm's constructor
759760 $form: the PreferencesForm
Index: trunk/phase3/includes/Wiki.php
@@ -51,7 +51,7 @@
5252 */
5353 function initialize( &$title, &$article, &$output, &$user, $request ) {
5454 wfProfileIn( __METHOD__ );
55 - $this->preliminaryChecks( $title, $output, $request ) ;
 55+ $this->preliminaryChecks( $title, $output, $request );
5656 if( !$this->initializeSpecialCases( $title, $output, $request ) ) {
5757 $new_article = $this->initializeArticle( $title, $request );
5858 if( is_object( $new_article ) ) {
@@ -131,7 +131,6 @@
132132 * @param $request WebRequest
133133 */
134134 function preliminaryChecks( &$title, &$output, $request ) {
135 -
136135 if( $request->getCheck( 'search' ) ) {
137136 // Compatibility with old search URLs which didn't use Special:Search
138137 // Just check for presence here, so blank requests still
@@ -140,7 +139,6 @@
141140 // Do this above the read whitelist check for security...
142141 $title = SpecialPage::getTitleFor( 'Search' );
143142 }
144 -
145143 # If the user is not logged in, the Namespace:title of the article must be in
146144 # the Read array in order for the user to see it. (We have to check here to
147145 # catch special pages etc. We check again in Article::view())
@@ -149,7 +147,6 @@
150148 $output->output();
151149 exit;
152150 }
153 -
154151 }
155152
156153 /**
@@ -309,7 +306,8 @@
310307 $dbr = wfGetDB( DB_SLAVE );
311308 $article->loadPageData( $article->pageDataFromTitle( $dbr, $title ) );
312309
313 - wfRunHooks( 'InitializeArticleMaybeRedirect', array( &$title, &$request, &$ignoreRedirect, &$target ) );
 310+ wfRunHooks( 'InitializeArticleMaybeRedirect',
 311+ array(&$title,&$request,&$ignoreRedirect,&$target,&$article) );
314312
315313 // Follow redirects only for... redirects
316314 if( !$ignoreRedirect && $article->isRedirect() ) {
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1140,7 +1140,7 @@
11411141 return true;
11421142 }
11431143
1144 - public static function overrideRedirect( &$title, $request, &$ignoreRedirect, &$target ) {
 1144+ public static function overrideRedirect( &$title, $request, &$ignoreRedirect, &$target, &$article ) {
11451145 # Get an instance on the title ($wgTitle)
11461146 if( !FlaggedRevs::isPageReviewable($title) ) {
11471147 return true;
@@ -1152,7 +1152,7 @@
11531153 # Try the cache...
11541154 $key = wfMemcKey( 'flaggedrevs', 'overrideRedirect', $title->getArticleId() );
11551155 $data = $wgMemc->get($key);
1156 - if( is_object($data) && $data->time > $title->getTouched() ) {
 1156+ if( is_object($data) && $data->time > $article->getTouched() ) {
11571157 list($ignoreRedirect,$target) = $data->value;
11581158 return true;
11591159 }

Status & tagging log