Page MenuHomePhabricator

Uploading LocalSettings.php does not always invalidate the file cache
Closed, ResolvedPublic

Description

Author: manfredfr

Description:
I switched off Ajax in LocalSetting.php by using $wgUseAjax = false. Still some pages included the script ajax.js.

The reason for this was the file cache which has not been invalidated by updating LocalSettings.php.

The cause for the problem is the following:
index.php is trying the file cache in line 85:

if( $cache->isFileCacheGood( /* Assume up to date */ ) ) {

isFileCacheGood in HTMLFileCache.php reacts this way:

if( !$timestamp ) return true; // should be invalidated on change

Therefore the cached page is used and $wgCacheEpoch is ignored.

The correct code for isFileCacheGood is:
if( !$this->isFileCached() ) return false;

$cachetime = $this->fileCacheTime();
if( !$timestamp && ( $wgCacheEpoch <= $cachetime) ) return true; // should be invalidated on change

$good = ...


Version: 1.15.x
Severity: major

Details

Reference
bz21161

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:46 PM
bzimport set Reference to bz21161.
bzimport added a subscriber: Unknown Object (MLST).

Patch fixing the issue

The if( !$timestamp ) return true; shortcut is intended to avoid having to call filemtime() (on fileCacheTime). Since we need to check the file time to follow $wgCacheEpoch, and the filemtime() value will be cached since we did a file_exists() on the previous line, skip it.

Attached:

manfredfr wrote:

Sorry for asking another time. Your patch is exactly the same code as I find in V 1.15.0, so I don't see how it would fix the problem.