added Minguo calendar support for the Taiwan Chinese language
[lhc/web/wiklou.git] / includes / HTMLFileCache.php
index ce4c11a..68cafa2 100644 (file)
@@ -128,7 +128,6 @@ class HTMLFileCache {
        public function loadFromFileCache() {
                global $wgOut, $wgMimeType, $wgOutputEncoding, $wgContLanguageCode;
                wfDebug(" loadFromFileCache()\n");
-
                $filename = $this->fileCacheName();
                // Raw pages should handle cache control on their own,
                // even when using file cache. This reduces hits from clients.
@@ -148,6 +147,7 @@ class HTMLFileCache {
                        }
                }
                readfile( $filename );
+               $wgOut->disable(); // tell $wgOut that output is taken care of
        }
 
        protected function checkCacheDirs() {
@@ -159,16 +159,12 @@ class HTMLFileCache {
                wfMkdirParents( $mydir2 );
        }
 
-       public function saveToFileCache( $origtext ) {
+       public function saveToFileCache( $text ) {
                global $wgUseFileCache;
-               if( !$wgUseFileCache ) {
-                       return $origtext; // return to output
+               if( !$wgUseFileCache || strlen( $text ) < 512 ) {
+                       // Disabled or empty/broken output (OOM and PHP errors)
+                       return $text;
                }
-               $text = $origtext;
-               // Empty?
-               if( strcmp($text,'') == 0 ) return '';
-               // Probably broken? (OOM and PHP errors)
-               if( mb_strlen($text) < 512 ) return $origtext;
 
                wfDebug(" saveToFileCache()\n", false);