r98741 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98740‎ | r98741 | r98742 >
Date:06:54, 3 October 2011
Author:aaron
Status:ok
Tags:
Comment:
Simplified cacheDirectory() in FileCacheBase and HTMLFileCache. It turns out $wgFileCacheDirectory is always set in setup.php already.
Modified paths:
  • /trunk/phase3/includes/cache/FileCacheBase.php (modified) (history)
  • /trunk/phase3/includes/cache/HTMLFileCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/cache/FileCacheBase.php
@@ -28,15 +28,8 @@
2929 * @return string
3030 */
3131 final protected function baseCacheDirectory() {
32 - global $wgCacheDirectory, $wgFileCacheDirectory, $wgFileCacheDepth;
33 - if ( $wgFileCacheDirectory ) {
34 - $dir = $wgFileCacheDirectory;
35 - } elseif ( $wgCacheDirectory ) {
36 - $dir = $wgCacheDirectory;
37 - } else {
38 - throw new MWException( 'Please set $wgCacheDirectory in LocalSettings.php if you wish to use the HTML file cache' );
39 - }
40 - return $dir;
 32+ global $wgFileCacheDirectory;
 33+ return $wgFileCacheDirectory;
4134 }
4235
4336 /**
Index: trunk/phase3/includes/cache/HTMLFileCache.php
@@ -35,19 +35,10 @@
3636
3737 /**
3838 * Get the base file cache directory
39 - * Note: avoids baseCacheDirectory() for b/c to not skip existing cache
4039 * @return string
4140 */
4241 protected function cacheDirectory() {
43 - global $wgCacheDirectory, $wgFileCacheDirectory, $wgFileCacheDepth;
44 - if ( $wgFileCacheDirectory ) {
45 - $dir = $wgFileCacheDirectory;
46 - } elseif ( $wgCacheDirectory ) {
47 - $dir = "$wgCacheDirectory/html";
48 - } else {
49 - throw new MWException( 'Please set $wgCacheDirectory in LocalSettings.php if you wish to use the HTML file cache' );
50 - }
51 - return $dir;
 42+ return $this->baseCacheDirectory(); // no subdir for b/c with old cache files
5243 }
5344
5445 /**

Status & tagging log