* Fix bug 13002
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 13 Feb 2008 05:46:43 +0000 (05:46 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 13 Feb 2008 05:46:43 +0000 (05:46 +0000)
* Fix excessive memory usage in MessageCache::loadFromLocal()

includes/Article.php
includes/MessageCache.php

index 188aee1..b2c6a7e 100644 (file)
@@ -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();
index 755d379..ce717fa 100644 (file)
@@ -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 );