jenkins-bot has submitted this change and it was merged. Change subject: rebuildLocalisationCache: Implement --lang option ......................................................................
rebuildLocalisationCache: Implement --lang option It would rebuild all language caches by default. We were lacking an option to rebuild only one language, for example when it get corrupted or the cache file for a language got removed. The new --lang accepts a list of comma separated langs to rebuild the cache for. Example usage: php rebuildLocalisationCache.php --lang en,fr,de Nonexistent languages are simply ignored. The script dies if it ends up with no languages to rebuild. Change-Id: I4c5e69abb76ffd8b88b595e3687edab3bb267ccc --- M RELEASE-NOTES-1.22 M maintenance/rebuildLocalisationCache.php 2 files changed, 17 insertions(+), 1 deletion(-) Approvals: Anomie: Looks good to me, approved jenkins-bot: Verified diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index aad11a0..eea9756 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -56,6 +56,8 @@ 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 diff --git a/maintenance/rebuildLocalisationCache.php b/maintenance/rebuildLocalisationCache.php index db77564..81e8904 100644 --- a/maintenance/rebuildLocalisationCache.php +++ b/maintenance/rebuildLocalisationCache.php @@ -44,6 +44,8 @@ $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 @@ } $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 -- To view, visit https://gerrit.wikimedia.org/r/61577 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4c5e69abb76ffd8b88b595e3687edab3bb267ccc Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Hashar <[email protected]> Gerrit-Reviewer: Anomie <[email protected]> Gerrit-Reviewer: Hashar <[email protected]> Gerrit-Reviewer: IAlex <[email protected]> Gerrit-Reviewer: Nikerabbit <[email protected]> Gerrit-Reviewer: Reedy <[email protected]> Gerrit-Reviewer: Siebrand <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
