Merge "rebuildLocalisationCache: Implement --lang option"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 1 May 2013 13:17:54 +0000 (13:17 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 1 May 2013 13:17:54 +0000 (13:17 +0000)
RELEASE-NOTES-1.22
maintenance/rebuildLocalisationCache.php

index c95b464..ffdaa39 100644 (file)
@@ -56,6 +56,8 @@ production.
   language links associated with a page before display.
 * Chosen (http://harvesthq.github.io/chosen/) was added as module 'jquery.chosen'
 * HTMLForm will turn multiselect checkboxes into a Chosen interface when setting cssclass 'mw-chosen'
+* rebuildLocalisationCache learned --lang option. Let you rebuild l10n caches
+  of the specified languages instead of all of them.
 
 === Bug fixes in 1.22 ===
 * Disable Special:PasswordReset when $wgEnableEmail. Previously one could still
index db77564..81e8904 100644 (file)
@@ -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