diff options
Diffstat (limited to 'includes/cache/FileCacheBase.php')
-rw-r--r-- | includes/cache/FileCacheBase.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/includes/cache/FileCacheBase.php b/includes/cache/FileCacheBase.php index d4bf5ee6387c..d5195c5a957b 100644 --- a/includes/cache/FileCacheBase.php +++ b/includes/cache/FileCacheBase.php @@ -51,6 +51,7 @@ abstract class FileCacheBase { */ final protected function baseCacheDirectory() { global $wgFileCacheDirectory; + return $wgFileCacheDirectory; } @@ -91,6 +92,7 @@ abstract class FileCacheBase { if ( $this->mCached === null ) { $this->mCached = file_exists( $this->cachePath() ); } + return $this->mCached; } @@ -100,6 +102,7 @@ abstract class FileCacheBase { */ public function cacheTimestamp() { $timestamp = filemtime( $this->cachePath() ); + return ( $timestamp !== false ) ? wfTimestamp( TS_MW, $timestamp ) : false; @@ -140,6 +143,7 @@ abstract class FileCacheBase { public function fetchText() { if ( $this->useGzip() ) { $fh = gzopen( $this->cachePath(), 'rb' ); + return stream_get_contents( $fh ); } else { return file_get_contents( $this->cachePath() ); @@ -165,10 +169,12 @@ abstract class FileCacheBase { if ( !file_put_contents( $this->cachePath(), $text, LOCK_EX ) ) { wfDebug( __METHOD__ . "() failed saving " . $this->cachePath() . "\n" ); $this->mCached = null; + return false; } $this->mCached = true; + return $text; } @@ -262,6 +268,7 @@ abstract class FileCacheBase { */ public function getMissesRecent() { global $wgMemc; + return self::MISS_FACTOR * $wgMemc->get( $this->cacheMissKey() ); } |