Created
September 27, 2011 00:10
-
-
Save bvibber/1243845 to your computer and use it in GitHub Desktop.
tweak to MessageCache::loadFromDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: includes/cache/MessageCache.php | |
=================================================================== | |
--- includes/cache/MessageCache.php (revision 98199) | |
+++ includes/cache/MessageCache.php (working copy) | |
@@ -428,7 +428,16 @@ | |
); | |
foreach ( $res as $row ) { | |
- $cache[$row->page_title] = ' ' . Revision::getRevisionText( $row ); | |
+ $text = Revision::getRevisionText( $row ); | |
+ if( $text === false ) { | |
+ // Failed to fetch data; possible ES errors? | |
+ // Store a marker to fetch on-demand as a workaround... | |
+ $entry = '!TOO BIG'; | |
+ wfDebugLog( 'MessageCache', __METHOD__ . ": failed to load message page text for {$row->page_title} ($code)" ); | |
+ } else { | |
+ $entry = ' ' . $text; | |
+ } | |
+ $cache[$row->page_title] = $entry; | |
} | |
foreach ( $mostused as $key ) { | |
@@ -741,8 +750,13 @@ | |
$revision = Revision::newFromTitle( Title::makeTitle( NS_MEDIAWIKI, $title ) ); | |
if ( $revision ) { | |
$message = $revision->getText(); | |
- $this->mCache[$code][$title] = ' ' . $message; | |
- $this->mMemc->set( $titleKey, ' ' . $message, $this->mExpiry ); | |
+ if ($message === false) { | |
+ // A possibly temporary loading failure. | |
+ wfDebugLog( 'MessageCache', __METHOD__ . ": failed to load message page text for {$title->getDbKey()} ($code)" ); | |
+ } else { | |
+ $this->mCache[$code][$title] = ' ' . $message; | |
+ $this->mMemc->set( $titleKey, ' ' . $message, $this->mExpiry ); | |
+ } | |
} else { | |
$message = false; | |
$this->mCache[$code][$title] = '!NONEXISTENT'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment