Merge "Improved handling of pending queue delisting."
[lhc/web/wiklou.git] / maintenance / rebuildLocalisationCache.php
index ffe66c6..db77564 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
 
+/**
+ * Maintenance script to rebuild the localisation cache.
+ *
+ * @ingroup Maintenance
+ */
 class RebuildLocalisationCache extends Maintenance {
        public function __construct() {
                parent::__construct();
                $this->mDescription = "Rebuild the localisation cache";
                $this->addOption( 'force', 'Rebuild all files, even ones not out of date' );
                $this->addOption( 'threads', 'Fork more than one thread', false, true );
-               $this->addOption( 'outdir', 'Override the output directory (normally $wgCacheDirectory)', 
+               $this->addOption( 'outdir', 'Override the output directory (normally $wgCacheDirectory)',
                        false, true );
        }
 
@@ -47,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;