diff options
Diffstat (limited to 'includes/HTMLFileCache.php')
-rw-r--r-- | includes/HTMLFileCache.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/includes/HTMLFileCache.php b/includes/HTMLFileCache.php index 68cafa24..53af1e6e 100644 --- a/includes/HTMLFileCache.php +++ b/includes/HTMLFileCache.php @@ -14,6 +14,7 @@ * - $wgCachePages * - $wgCacheEpoch * - $wgUseFileCache + * - $wgCacheDirectory * - $wgFileCacheDirectory * - $wgUseGzip * @@ -30,7 +31,16 @@ class HTMLFileCache { public function fileCacheName() { if( !$this->mFileCache ) { - global $wgFileCacheDirectory, $wgRequest; + global $wgCacheDirectory, $wgFileCacheDirectory, $wgRequest; + + 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' ); + } + # Store raw pages (like CSS hits) elsewhere $subdir = ($this->mType === 'raw') ? 'raw/' : ''; $key = $this->mTitle->getPrefixedDbkey(); @@ -45,7 +55,7 @@ class HTMLFileCache { if( $this->useGzip() ) $this->mFileCache .= '.gz'; - wfDebug( " fileCacheName() - {$this->mFileCache}\n" ); + wfDebug( __METHOD__ . ": {$this->mFileCache}\n" ); } return $this->mFileCache; } @@ -96,12 +106,11 @@ class HTMLFileCache { global $wgCacheEpoch; if( !$this->isFileCached() ) return false; - if( !$timestamp ) return true; // should be invalidated on change $cachetime = $this->fileCacheTime(); $good = $timestamp <= $cachetime && $wgCacheEpoch <= $cachetime; - wfDebug(" isFileCacheGood() - cachetime $cachetime, touched '{$timestamp}' epoch {$wgCacheEpoch}, good $good\n"); + wfDebug( __METHOD__ . ": cachetime $cachetime, touched '{$timestamp}' epoch {$wgCacheEpoch}, good $good\n"); return $good; } @@ -127,7 +136,7 @@ class HTMLFileCache { /* Working directory to/from output */ public function loadFromFileCache() { global $wgOut, $wgMimeType, $wgOutputEncoding, $wgContLanguageCode; - wfDebug(" loadFromFileCache()\n"); + wfDebug( __METHOD__ . "()\n"); $filename = $this->fileCacheName(); // Raw pages should handle cache control on their own, // even when using file cache. This reduces hits from clients. @@ -166,7 +175,7 @@ class HTMLFileCache { return $text; } - wfDebug(" saveToFileCache()\n", false); + wfDebug( __METHOD__ . "()\n", false); $this->checkCacheDirs(); |