Page MenuHomePhabricator

'MWException' with message 'No localisation cache found for English. Please run maintenance/rebuildLocalisationCache.php.' when running rebuildLocalisationCache.php
Closed, ResolvedPublic

Description

When running maintenance/rebuildLocalisationCache.php on a new wiki (it's a new wiki, MWScript.php is just a wrapper for maintenance scripts to select the correct wiki) I get this error, when ConfirmEdit is installed:

Fatal error: Uncaught exception 'MWException' with message 'No localisation cache found for English. Please run maintenance/rebuildLocalisationCache.php.' in /data/mediawiki/main/includes/cache/localisation/LocalisationCache.php:481
Stack trace:
#0 /data/mediawiki/main/includes/cache/localisation/LocalisationCache.php(338): LocalisationCache->initLanguage()
#1 /data/mediawiki/main/includes/cache/localisation/LocalisationCache.php(275): LocalisationCache->loadItem()
#2 /data/mediawiki/main/languages/Language.php(3189): LocalisationCache->getItem()
#3 /data/mediawiki/main/includes/specialpage/SpecialPageFactory.php(679): Language->getSpecialPageAliases()
#4 /data/mediawiki/main/includes/specialpage/SpecialPage.php(81): SpecialPageFactory::getLocalNameFor()
#5 /data/mediawiki/extensions/ConfirmEdit/includes/ConfirmEditHooks.php(183): SpecialPage::getTitleFor()
#6 /data/mediawiki/main/includes/Setup.php(845): ConfirmEditHooks::confirmEditSetup()
#7 /data/mediawiki/main/maintenance/doMaintenance.php(97): include()
#8 /data/mediawiki/main/maintenance/rebuildLocalisationCache.php(181): include()
#9 /data/mediawiki/mw-config/mw-config/multiversion/MWScript.php(98): include()
#10 {main}
Set $wgShowExceptionDetails = true; in LocalSettings.php to show detailed debugging information.

The problem is, that ConfirmEdit calls SpecialPageFactory::getTitleFor() in the initialization process of MediaWiki. Because this is not possible when no i18n cache is built (and manualRecache is set to true). However, ConfirmEdit shouldn't block running maintenance script in this case (as it's not possible to rebuild the cache, until ConfirmEdit is removed from the setup).

Event Timeline

Florian created this task.Aug 5 2016, 9:19 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 5 2016, 9:19 PM

Hmm, I would like to have a "LocalisationException", which could be catched in the initialisation callback :/ Now we would need to require the admins to whitelist the pages manually (which doesn't sound sooo bad), or catch all exceptions of type MWException (even those, we don't want to catch) :(

What does the I18n MediaWiki-Internationalization team thinks about that? :)

Legoktm added a subscriber: Legoktm.EditedAug 18 2016, 3:24 AM

The problem is, that ConfirmEdit calls SpecialPageFactory::getTitleFor() in the initialization process of MediaWiki

This is wrong. Is there no hook that can be used instead? What about one of the user permissions ones?

Florian claimed this task.Aug 18 2016, 5:58 PM

Yes, let's use the appropriate hook for that :)

Change 305550 had a related patch set uploaded (by Florianschmidtwelzow):
Use TitleReadWhitelist for automatic whitelist

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

Change 305550 merged by jenkins-bot:
Use TitleReadWhitelist for automatic whitelist

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

Florian closed this task as Resolved.Aug 19 2016, 2:29 PM
Nikerabbit added a subscriber: Nikerabbit.

This also fixes T144009. Can we backport it to REL1_27 please? I tried cherry-pick but gerrit says merge conflict.

Sure, I'll upload a change to REL1_27 (merge conflict is because of a change to the hooks list in extension.json).

See change: https://gerrit.wikimedia.org/r/#/c/307707/ (not sure why @gerritbot does not mention it here).

Change 307707 merged by jenkins-bot:
Use TitleReadWhitelist for automatic whitelist

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