Nikerabbit has uploaded a new change for review. https://gerrit.wikimedia.org/r/61543
Change subject: Add refresh-translatable-pages.php script ...................................................................... Add refresh-translatable-pages.php script Change-Id: Iac3f1aabea90fad0a30eb6805e14d0a21ab12926 --- A scripts/refresh-translatable-pages.php 1 file changed, 51 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/43/61543/1 diff --git a/scripts/refresh-translatable-pages.php b/scripts/refresh-translatable-pages.php new file mode 100644 index 0000000..97332ea --- /dev/null +++ b/scripts/refresh-translatable-pages.php @@ -0,0 +1,51 @@ +<?php +/** + * Script to ensure all translation pages are up to date. + * + * @author Niklas Laxström + * @license GPL2+ + * @file + */ + +// Standard boilerplate to define $IP +if ( getenv( 'MW_INSTALL_PATH' ) !== false ) { + $IP = getenv( 'MW_INSTALL_PATH' ); +} else { + $dir = dirname( __FILE__ ); + $IP = "$dir/../../.."; +} +require_once( "$IP/maintenance/Maintenance.php" ); + +/** + * Script to ensure all translation pages are up to date + * @since 2013-04 + */ +class RefreshTranslatablePages extends Maintenance { + public function __construct() { + parent::__construct(); + $this->mDescription = 'Ensure all translation pages are up to date'; + } + + public function execute() { + $groups = MessageGroups::singleton()->getGroups(); + + /** @var MessageGroup $group */ + foreach ( $groups as $id => $group ) { + if ( !$group instanceof WikiPageMessageGroup ) { + continue; + } + + // Get all translation subpages and refresh each one of them + $page = TranslatablePage::newFromTitle( $group->getTitle() ); + $translationPages = $page->getTranslationPages(); + + foreach ( $translationPages as $subpage ) { + $job = TranslateRenderJob::newJob( $subpage ); + $job->run(); + } + } + } +} + +$maintClass = 'RefreshTranslatablePages'; +require_once( RUN_MAINTENANCE_IF_MAIN ); -- To view, visit https://gerrit.wikimedia.org/r/61543 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iac3f1aabea90fad0a30eb6805e14d0a21ab12926 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: wmf/1.22wmf2 Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits