diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-12-08 09:55:49 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-12-08 09:55:49 +0100 |
commit | 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch) | |
tree | af68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /maintenance/rebuildLocalisationCache.php | |
parent | af4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff) |
Update to MediaWiki 1.22.0
Diffstat (limited to 'maintenance/rebuildLocalisationCache.php')
-rw-r--r-- | maintenance/rebuildLocalisationCache.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/maintenance/rebuildLocalisationCache.php b/maintenance/rebuildLocalisationCache.php index db77564b..b7f306b1 100644 --- a/maintenance/rebuildLocalisationCache.php +++ b/maintenance/rebuildLocalisationCache.php @@ -29,7 +29,7 @@ * @ingroup Maintenance */ -require_once( __DIR__ . '/Maintenance.php' ); +require_once __DIR__ . '/Maintenance.php'; /** * Maintenance script to rebuild the localisation cache. @@ -44,6 +44,8 @@ class RebuildLocalisationCache extends Maintenance { $this->addOption( 'threads', 'Fork more than one thread', false, true ); $this->addOption( 'outdir', 'Override the output directory (normally $wgCacheDirectory)', false, true ); + $this->addOption( 'lang', 'Only rebuild these languages, comma separated.', + false, true ); } public function memoryLimit() { @@ -59,7 +61,7 @@ class RebuildLocalisationCache extends Maintenance { # no l10n cache. Break the cycle by forcing $wgLanguageCode = 'en'. global $wgLanguageCode; $wgLanguageCode = 'en'; - return parent::finalSetup(); + parent::finalSetup(); } public function execute() { @@ -90,7 +92,19 @@ class RebuildLocalisationCache extends Maintenance { } $lc = new LocalisationCache_BulkLoad( $conf ); - $codes = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) ); + $allCodes = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) ); + if ( $this->hasOption( 'lang' ) ) { + # Validate requested languages + $codes = array_intersect( $allCodes, + explode( ',', $this->getOption( 'lang' ) ) ); + # Bailed out if nothing is left + if ( count( $codes ) == 0 ) { + $this->error( 'None of the languages specified exists.', 1 ); + } + } else { + # By default get all languages + $codes = $allCodes; + } sort( $codes ); // Initialise and split into chunks @@ -162,4 +176,4 @@ class RebuildLocalisationCache extends Maintenance { } $maintClass = "RebuildLocalisationCache"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +require_once RUN_MAINTENANCE_IF_MAIN; |