29 public function __construct() {
30 parent::__construct();
31 $this->addDescription(
'Ensure all translation pages are up to date.' );
32 $this->setBatchSize( 300 );
33 $this->addOption(
'jobqueue',
'Use JobQueue (asynchronous)' );
34 $this->requireExtension(
'Translate' );
37 public function execute() {
38 $groups = MessageGroups::singleton()->getGroups();
39 $mwInstance = MediaWikiServices::getInstance();
40 $lbFactory = $mwInstance->getDBLoadBalancerFactory();
41 $jobQueueGroup = $mwInstance->getJobQueueGroup();
44 $useJobQueue = $this->hasOption(
'jobqueue' );
47 foreach ( $groups as $group ) {
53 if ( ( $counter % $this->mBatchSize ) === 0 ) {
54 $lbFactory->waitForReplication();
57 $page = TranslatablePage::newFromTitle( $group->getTitle() );
58 $jobs = UpdateTranslatablePageJob::getRenderJobs( $page );
60 $jobQueueGroup->push( $jobs );
62 foreach ( $jobs as $job ) {
69 $this->output(
"Queued refresh for $counter translatable pages.\n" );
71 $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.