fixed check for old cache values in commons, and some other stuff
[lhc/web/wiklou.git] / includes / CacheManager.php
index 1a5711b..0360ab8 100644 (file)
@@ -2,6 +2,7 @@
 /**
  * Contain the CacheManager class
  * @package MediaWiki
+ * @subpackage Cache
  */
 
 /**
@@ -31,11 +32,11 @@ class CacheManager {
        }
        
        function fileCacheName() {
-               global $wgFileCacheDirectory, $wgLang;
+               global $wgFileCacheDirectory, $wgContLang;
                if( !$this->mFileCache ) {
                        $hash = md5( $key = $this->mTitle->getDbkey() );
                        if( $this->mTitle->getNamespace() )
-                               $key = $wgLang->getNsText( $this->mTitle->getNamespace() ) . ":" . $key;
+                               $key = $wgContLang->getNsText( $this->mTitle->getNamespace() ) . ":" . $key;
                        $key = str_replace( '.', '%2E', urlencode( $key ) );
                        
                        $hash1 = substr( $hash, 0, 1 );
@@ -55,7 +56,7 @@ class CacheManager {
        }
        
        function fileCacheTime() {
-               return wfUnix2Timestamp( filemtime( $this->fileCacheName() ) );
+               return wfTimestamp( TS_MW, filemtime( $this->fileCacheName() ) );
        }
        
        function isFileCacheGood( $timestamp ) {
@@ -92,11 +93,14 @@ class CacheManager {
        
        /* Working directory to/from output */
        function loadFromFileCache() {
-               global $wgOut;
+               global $wgOut, $wgMimeType, $wgOutputEncoding, $wgContLanguageCode;
                wfDebug(" loadFromFileCache()\n");
                
                $filename=$this->fileCacheName();
                $wgOut->sendCacheControl();
+
+               header( "Content-type: $wgMimeType; charset={$wgOutputEncoding}" );
+               header( "Content-language: $wgContLanguageCode" );
                
                if( $this->useGzip() ) {
                        if( wfClientAcceptsGzip() ) {