* (bug 25175) HTML file cache now honor $wgCacheDirectory if $wgFileCacheDirectory...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 8 Nov 2010 11:32:40 +0000 (11:32 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 8 Nov 2010 11:32:40 +0000 (11:32 +0000)
This reverts part of r74797

RELEASE-NOTES
includes/HTMLFileCache.php

index c50482c..ed9d3cb 100644 (file)
@@ -405,6 +405,8 @@ LocalSettings.php. The specific bugs are listed below in the general notes.
 * (bug 25713) SpecialPage::resolveAlias() now normalise spaces to underscores
 * (bug 25829) Special:Mypage and Special:Mytalk now forward oldid, diff and dir
   parameters
+* (bug 25175) HTML file cache now honor $wgCacheDirectory if
+  $wgFileCacheDirectory is not set
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index edae81b..80744f7 100644 (file)
@@ -32,7 +32,11 @@ class HTMLFileCache {
                if( !$this->mFileCache ) {
                        global $wgCacheDirectory, $wgFileCacheDirectory;
 
-                       if ( !$wgFileCacheDirectory && !$wgCacheDirectory ) {
+                       if ( $wgFileCacheDirectory ) {
+                               $dir = $wgFileCacheDirectory;
+                       } elseif ( $wgCacheDirectory ) {
+                               $dir = "$wgCacheDirectory/html";
+                       } else {
                                throw new MWException( 'Please set $wgCacheDirectory in LocalSettings.php if you wish to use the HTML file cache' );
                        }
 
@@ -45,7 +49,7 @@ class HTMLFileCache {
        
                        $hash1 = substr( $hash, 0, 1 );
                        $hash2 = substr( $hash, 0, 2 );
-                       $this->mFileCache = "{$wgFileCacheDirectory}/{$subdir}{$hash1}/{$hash2}/{$key}.html";
+                       $this->mFileCache = "{$dir}/{$subdir}{$hash1}/{$hash2}/{$key}.html";
 
                        if( $this->useGzip() ) {
                                $this->mFileCache .= '.gz';