X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjob%2Fjobs%2FRefreshLinksJob.php;h=78ac84d76b3b8e050606329d3768fada584a91b4;hb=c01fb8e3c401630832504e5c8a8b8da6c49862c9;hp=c94db75a806c7b06a2cde4cfe709f36c983f514c;hpb=64351077ef4705e1a386eb0dfefe74bbb031717a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/job/jobs/RefreshLinksJob.php b/includes/job/jobs/RefreshLinksJob.php index c94db75a80..78ac84d76b 100644 --- a/includes/job/jobs/RefreshLinksJob.php +++ b/includes/job/jobs/RefreshLinksJob.php @@ -35,8 +35,8 @@ * @ingroup JobQueue */ class RefreshLinksJob extends Job { - function __construct( $title, $params = '', $id = 0 ) { - parent::__construct( 'refreshLinks', $title, $params, $id ); + function __construct( $title, $params = '' ) { + parent::__construct( 'refreshLinks', $title, $params ); // Base backlink update jobs and per-title update jobs can be de-duplicated. // If template A changes twice before any jobs run, a clean queue will have: // (A base, A base) @@ -133,6 +133,10 @@ class RefreshLinksJob extends Job { if ( isset( $this->params['rootJobTimestamp'] ) ) { $page = WikiPage::factory( $title ); $skewedTimestamp = wfTimestamp( TS_UNIX, $this->params['rootJobTimestamp'] ) + 5; + if ( $page->getLinksTimestamp() > wfTimestamp( TS_MW, $skewedTimestamp ) ) { + // Something already updated the backlinks since this job was made + return true; + } if ( $page->getTouched() > wfTimestamp( TS_MW, $skewedTimestamp ) ) { $parserOptions = $page->makeParserOptions( 'canonical' ); $parserOutput = ParserCache::singleton()->getDirty( $page, $parserOptions ); @@ -170,4 +174,8 @@ class RefreshLinksJob extends Job { return $info; } + + public function workItemCount() { + return isset( $this->params['pages'] ) ? count( $this->params['pages'] ) : 1; + } }