mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-15 12:00:40 +00:00
bc4b81c7bb
$params cannot a bool here Job::run has to return a bool Change-Id: Ieed6675e8de0e3ed4c3376676d5b027a6ab9f4f2
40 lines
966 B
PHP
40 lines
966 B
PHP
<?php
|
|
|
|
namespace PageImages\Job;
|
|
|
|
use Job;
|
|
use MediaWiki\MediaWikiServices;
|
|
use MWExceptionHandler;
|
|
use RefreshLinks;
|
|
use Title;
|
|
|
|
class InitImageDataJob extends Job {
|
|
/**
|
|
* @param Title $title Title object associated with this job
|
|
* @param array $params Parameters to the job, containing an array of
|
|
* page ids representing which pages to process
|
|
*/
|
|
public function __construct( Title $title, array $params ) {
|
|
parent::__construct( 'InitImageDataJob', $title, $params );
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function run() {
|
|
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
|
|
|
|
foreach ( $this->params['page_ids'] as $id ) {
|
|
try {
|
|
RefreshLinks::fixLinksFromArticle( $id );
|
|
$lbFactory->waitForReplication();
|
|
} catch ( \Exception $e ) {
|
|
// There are some broken pages out there that just don't parse.
|
|
// Log it and keep on trucking.
|
|
MWExceptionHandler::logException( $e );
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|