From: Tim Starling Date: Wed, 13 Feb 2008 05:46:43 +0000 (+0000) Subject: * Fix bug 13002 X-Git-Tag: 1.31.0-rc.0~49495 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=870e2c7e32b033dbb9f39315e20476d191d4a5d5;p=lhc%2Fweb%2Fwiklou.git * Fix bug 13002 * Fix excessive memory usage in MessageCache::loadFromLocal() --- diff --git a/includes/Article.php b/includes/Article.php index 188aee1ed5..b2c6a7e6dd 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -980,7 +980,11 @@ class Article { } if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { global $wgMessageCache; - $text = $this->getContent(); + if ( $this->getID() == 0 ) { + $text = false; + } else { + $text = $this->getContent(); + } $wgMessageCache->replace( $this->mTitle->getDBkey(), $text ); } $this->view(); diff --git a/includes/MessageCache.php b/includes/MessageCache.php index 755d379e3e..ce717fa804 100644 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -78,7 +78,10 @@ class MessageCache { $localHash = fread( $file, 32 ); if ( $hash === $localHash ) { // All good, get the rest of it - $serialized = fread( $file, 20000000 ); + $serialized = ''; + while ( !feof( $file ) ) { + $serialized .= fread( $file, 100000 ); + } $this->setCache( unserialize( $serialized ) ); } fclose( $file );