r40344 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40343‎ | r40344 | r40345 >
Date:21:56, 2 September 2008
Author:aaron
Status:old
Tags:
Comment:
Performance tweaks
Modified paths:
  • /trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1112,7 +1112,9 @@
11131113 }
11141114
11151115 public static function overrideRedirect( &$title, $request, &$ignoreRedirect, &$target ) {
1116 - if( !FlaggedRevs::isPageReviewable( $title ) ) {
 1116+ # Get an instance on the title ($wgTitle)
 1117+ $fa = FlaggedArticle::getTitleInstance( $title );
 1118+ if( !$fa->isReviewable() ) {
11171119 return true;
11181120 }
11191121 if( $request->getVal( 'stableid' ) ) {
@@ -1124,10 +1126,11 @@
11251127 $data = $wgMemc->get($key);
11261128 if( is_object($data) && count($data->value) == 2 && $data->time >= $title->getTouched() ) {
11271129 list($ignoreRedirect,$target) = $data->value;
1128 - # Get an instance on the title ($wgTitle) and save to process cache
1129 - } else {
1130 - $flaggedArticle = FlaggedArticle::getTitleInstance( $title );
1131 - if( $flaggedArticle->pageOverride() && $srev = $flaggedArticle->getStableRev( FR_TEXT ) ) {
 1130+ return true;
 1131+ }
 1132+ if( $srev = $flaggedArticle->getStableRev() ) {
 1133+ # If synced, nothing special here...
 1134+ if( $srev->getRevId() != $title->getLatestRevID() && $fa->pageOverride() ) {
11321135 $text = $srev->getRevText();
11331136 $redirect = $flaggedArticle->followRedirectText( $text );
11341137 if( $redirect ) {
@@ -1135,9 +1138,9 @@
11361139 } else {
11371140 $ignoreRedirect = true;
11381141 }
 1142+ $data = FlaggedRevs::makeMemcObj( array($ignoreRedirect,$target) );
 1143+ $wgMemc->set( $key, $data, $wgParserCacheExpireTime );
11391144 }
1140 - $data = FlaggedRevs::makeMemcObj( array($ignoreRedirect,$target) );
1141 - $wgMemc->set( $key, $data, $wgParserCacheExpireTime );
11421145 }
11431146 }
11441147 return true;
@@ -1240,12 +1243,9 @@
12411244 }
12421245
12431246 public static function isFileCacheable( &$article ) {
1244 - if( !FlaggedRevs::isPageReviewable( $article->getTitle() ) ) {
1245 - return true;
1246 - }
12471247 $fa = FlaggedArticle::getInstance( $article );
12481248 # If the stable is the default, and we are viewing it...cache it!
1249 - if( $fa->showStableByDefault() ) {
 1249+ if( $fa->isReviewable() && $fa->showStableByDefault() ) {
12501250 return ( $fa->pageOverride() && $fa->getStableRev() );
12511251 # If the draft is the default, and we are viewing it...cache it!
12521252 } else {
Index: trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php
@@ -204,7 +204,7 @@
205205 function efLoadConfirmAccount() {
206206 global $wgUser;
207207 # Don't load unless needed
208 - if( $wgUser->isAllowed('confirmaccount') ) {
 208+ if( $wgUser->getId() && $wgUser->isAllowed('confirmaccount') ) {
209209 efConfirmAccountInjectStyle();
210210 }
211211 }