Allow non-English wikis to rebuild l10n cache
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 10 Jan 2013 20:32:40 +0000 (15:32 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 10 Jan 2013 20:54:15 +0000 (15:54 -0500)
If a wiki is configured to use the l10n cache and $wgLanguageCode is set
to anything other that 'en', all maintenance scripts will fail until the
l10n cache is build for the first time. This includes
maintenance/rebuildLocalisationCache.php, the maintenance script that
builds the l10n cache.

To break this dependency, have maintenance/rebuildLocalisationCache.php
force $wgLanguageCode = 'en'.

Change-Id: Ia93998b0f85fd122dd7b01eeeef698f595360945

maintenance/rebuildLocalisationCache.php

index 83849de..db77564 100644 (file)
@@ -53,6 +53,15 @@ class RebuildLocalisationCache extends Maintenance {
                return '1000M';
        }
 
+       public function finalSetup() {
+               # This script needs to be run to build the inital l10n cache. But if
+               # $wgLanguageCode is not 'en', it won't be able to run because there is
+               # no l10n cache. Break the cycle by forcing $wgLanguageCode = 'en'.
+               global $wgLanguageCode;
+               $wgLanguageCode = 'en';
+               return parent::finalSetup();
+       }
+
        public function execute() {
                global $wgLocalisationCacheConf;