31 private const USE_NON_PRIORITIZED_JOBS =
true;
33 public function __construct() {
34 parent::__construct();
35 $this->addDescription(
'Ensure all translation pages are up to date.' );
36 $this->setBatchSize( 300 );
37 $this->addOption(
'jobqueue',
'Use JobQueue (asynchronous)' );
38 $this->requireExtension(
'Translate' );
41 public function execute() {
42 $groups = MessageGroups::singleton()->getGroups();
43 $mwInstance = MediaWikiServices::getInstance();
44 $jobQueueGroup = $mwInstance->getJobQueueGroup();
48 $useJobQueue = $this->hasOption(
'jobqueue' );
50 foreach ( $groups as $group ) {
56 if ( ( $counter % $this->mBatchSize ) === 0 ) {
57 $this->waitForReplication();
60 $page = TranslatablePage::newFromTitle( $group->getTitle() );
61 $jobs = UpdateTranslatablePageJob::getRenderJobs( $page, self::USE_NON_PRIORITIZED_JOBS );
63 $jobCounter += count( $jobs );
64 $jobQueueGroup->push( $jobs );
66 foreach ( $jobs as $job ) {
73 $this->output(
"Queued $jobCounter refresh job(s) for $counter translatable pages.\n" );
75 $this->output(
"Refreshed $counter translatable pages.\n" );
Script to ensure all translation pages are up to date.
Wraps the translatable page sections into a message group.