MediaWiki REL1_34
InitImageDataJob.php
Go to the documentation of this file.
1<?php
2
3namespace PageImages\Job;
4
5use Job;
9use Title;
10
11class InitImageDataJob extends Job {
17 public function __construct( Title $title, array $params ) {
18 parent::__construct( 'InitImageDataJob', $title, $params );
19 }
20
24 public function run() {
25 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
26
27 foreach ( $this->params['page_ids'] as $id ) {
28 try {
30 $lbFactory->waitForReplication();
31 } catch ( \Exception $e ) {
32 // There are some broken pages out there that just don't parse.
33 // Log it and keep on trucking.
35 }
36 }
37 return true;
38 }
39}
Class to both describe a background job and handle jobs.
Definition Job.php:30
Title $title
Definition Job.php:41
array $params
Array of job parameters.
Definition Job.php:35
Handler class for MWExceptions.
static logException( $e, $catcher=self::CAUGHT_BY_OTHER, $extraData=[])
Log an exception to the exception log (if enabled).
MediaWikiServices is the service locator for the application scope of MediaWiki.
__construct(Title $title, array $params)
run()
Run the job.bool Success
Represents a title within MediaWiki.
Definition Title.php:42