/**
* Handles talking to the file cache, putting stuff in and taking it back out.
- * Mostly called from Article.php, also from DatabaseFunctions.php for the
- * emergency abort/fallback to cache.
+ * Mostly called from Article.php for the emergency abort/fallback to cache.
*
* Global options that affect this module:
* - $wgCachePages
public function fileCacheName() {
if( !$this->mFileCache ) {
- global $wgCacheDirectory, $wgFileCacheDirectory, $wgRequest;
+ global $wgCacheDirectory, $wgFileCacheDirectory;
if ( $wgFileCacheDirectory ) {
$dir = $wgFileCacheDirectory;
global $wgCacheEpoch;
if( !$this->isFileCached() ) return false;
- if( !$timestamp ) return true; // should be invalidated on change
$cachetime = $this->fileCacheTime();
$good = $timestamp <= $cachetime && $wgCacheEpoch <= $cachetime;
/* Working directory to/from output */
public function loadFromFileCache() {
- global $wgOut, $wgMimeType, $wgOutputEncoding, $wgContLanguageCode;
+ global $wgOut, $wgMimeType, $wgOutputEncoding, $wgLanguageCode;
wfDebug( __METHOD__ . "()\n");
$filename = $this->fileCacheName();
// Raw pages should handle cache control on their own,
if( $this->mType !== 'raw' ) {
$wgOut->sendCacheControl();
header( "Content-Type: $wgMimeType; charset={$wgOutputEncoding}" );
- header( "Content-Language: $wgContLanguageCode" );
+ header( "Content-Language: $wgLanguageCode" );
}
if( $this->useGzip() ) {
public static function clearFileCache( $title ) {
global $wgUseFileCache;
- if( !$wgUseFileCache ) return false;
+
+ if ( !$wgUseFileCache ) {
+ return false;
+ }
+
+ wfSuppressWarnings();
+
$fc = new self( $title, 'view' );
- @unlink( $fc->fileCacheName() );
+ unlink( $fc->fileCacheName() );
+
$fc = new self( $title, 'raw' );
- @unlink( $fc->fileCacheName() );
+ unlink( $fc->fileCacheName() );
+
+ wfRestoreWarnings();
+
return true;
}
}