Page MenuHomePhabricator

Update.php should purge ResourceLoader cache (fixes stale links after moving a wiki)
Closed, ResolvedPublic

Description

When MediaWiki is moved (physically on-disk that is, the web-facing paths are not relevant in this case) the ResourceLoader cache that contains links to file paths (specifically the contents of the module_deps table) are not purged in anyway.

I'm not sure what the right way to detect a purge-need is, but it's causing php errors like the following (Thanks to JasonJarde for reporting this on IRC):

PHP Warning: filemtime(): stat failed for /home/user/oldpath/wiki/resources/jquery.ui/themes/vector/images/button-down-green.png in /home/user/oldpath/wiki/includes/resourceloader/ResourceLoaderFileModule.php on line 380

...because those paths no longer exist.

For now I recommended JasonJarde to manually DELETE all contents of the module_deps table and that fixes the problem.

Possible solutions I can think of:

  • Somehow detect that paths have changed
  • Create a maintenance script to clear this cache

I'm not a fan of the latter because a move may not be the only cause for this and when possible I'd like to avoid a manual fix. Having to run a maintenance script is automated in some way, but it still requires manual intervention and knowing that that script has to be ran. ResourceLoader should be able to figure out the caching.


Version: 1.17.x
Severity: enhancement

Details

Reference
bz35472

Event Timeline

bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz35472.
bzimport added a subscriber: Unknown Object (MLST).
Krinkle created this task.Mar 25 2012, 7:55 PM

release is imminent.

See also bug 44524.

drobbins wrote:

The simplest solution would be to add module_deps to the list of SQL caches that maintenance/update.php wipes when it runs.

According to http://www.mediawiki.org/wiki/Manual:Update.php, update.php already wipes a variety of caches stored in SQL, including the other ones related to ResourceLoader. It seems that maybe module_deps should have been added to this list.

Adding m along with doc changes instructing wiki admins to run update.php after a wiki migration/restore/move, this problem is solved for everyone.

I think it's much more intuitive to continue to have update.php take care of the SQL cache issue in one feel swoop rather than have a separate command for module_deps.

drobbins wrote:

Bump on this. This is a pretty ugly bug when dealing with wiki migrations. See my comment above on an easy fix.

Krinkle: Does the approach in comment 3 sound feasible?

Daniel: If the approach gets an OK and if you feel like cooking up a patch, see https://www.mediawiki.org/wiki/Developer_access and https://www.mediawiki.org/wiki/Git/Tutorial

Yes. If update.php already cleans other tables the same way, let's just add this one to it.

Change 203395 had a related patch set uploaded (by Krinkle):
installer: Clear module_deps cache in updater

https://gerrit.wikimedia.org/r/203395

Krinkle renamed this task from ResourceLoader cache is broken after moving MediaWiki to Update.php should purge ResourceLoader cache (fixes stale links after moving a wiki).Apr 10 2015, 7:39 PM
Krinkle claimed this task.
Krinkle edited projects, added MW-1.25-release, MediaWiki-Installer; removed Future-Release.
Krinkle set Security to None.
Krinkle removed subscribers: gerritbot, Unknown Object (MLST).

Change 203395 merged by jenkins-bot:
installer: Clear module_deps cache in updater

https://gerrit.wikimedia.org/r/203395

Change 203631 had a related patch set uploaded (by Legoktm):
installer: Clear module_deps cache in updater

https://gerrit.wikimedia.org/r/203631

Change 203631 merged by Legoktm:
installer: Clear module_deps cache in updater

https://gerrit.wikimedia.org/r/203631

Legoktm closed this task as Resolved.Apr 12 2015, 1:11 AM
Legoktm added a subscriber: Legoktm.