MediaWiki  1.34.0
InitImageDataJob.php
Go to the documentation of this file.
1 <?php
2 
3 namespace PageImages\Job;
4 
5 use Job;
8 use RefreshLinks;
9 use Title;
10 
11 class 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 }
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
MWExceptionHandler
Handler class for MWExceptions.
Definition: MWExceptionHandler.php:30
Job\$title
Title $title
Definition: Job.php:41
Job\$params
array $params
Array of job parameters.
Definition: Job.php:35
MediaWiki\MediaWikiServices\getInstance
static getInstance()
Returns the global default instance of the top level service locator.
Definition: MediaWikiServices.php:138
Job
Class to both describe a background job and handle jobs.
Definition: Job.php:30
PageImages\Job\InitImageDataJob
Definition: InitImageDataJob.php:11
PageImages\Job\InitImageDataJob\__construct
__construct(Title $title, array $params)
Definition: InitImageDataJob.php:17
PageImages\Job
Definition: InitImageDataJob.php:3
Title
Represents a title within MediaWiki.
Definition: Title.php:42
PageImages\Job\InitImageDataJob\run
run()
Run the job.bool Success
Definition: InitImageDataJob.php:24
MWExceptionHandler\logException
static logException( $e, $catcher=self::CAUGHT_BY_OTHER, $extraData=[])
Log an exception to the exception log (if enabled).
Definition: MWExceptionHandler.php:691