X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrebuildLocalisationCache.php;h=ee6ddbbfe6e93a074f2cdc82ec9c145351a9785a;hb=66e8143bf5c22b8d44ec5189fe2bea32df2d91c3;hp=db77564b36171af4bb25b11bf7258336e4d55352;hpb=490780c68a082d44a5648ba1de400331c75f0b33;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildLocalisationCache.php b/maintenance/rebuildLocalisationCache.php index db77564b36..ee6ddbbfe6 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() { @@ -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;