X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2Fjobs%2FRefreshLinksJob.php;h=8854c6560fa520ebbc2240e10bd2f19d6f799cda;hb=4be80912c8a2217344bddde64824f93d19d094db;hp=9f3550f269b3987d8b7f0b70a0bab6eef1fa1f2d;hpb=c6acd961c37a7454d93e5c9a7ee1f9782a16abf4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index 9f3550f269..8854c6560f 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -53,6 +53,7 @@ class RefreshLinksJob extends Job { // Multiple pages per job make matches unlikely !( isset( $params['pages'] ) && count( $params['pages'] ) != 1 ) ); + $this->params += [ 'causeAction' => 'unknown', 'causeAgent' => 'unknown' ]; } /** @@ -102,6 +103,9 @@ class RefreshLinksJob extends Job { // Carry over information for de-duplication $extraParams = $this->getRootJobParams(); $extraParams['triggeredRecursive'] = true; + // Carry over cause information for logging + $extraParams['causeAction'] = $this->params['causeAction']; + $extraParams['causeAgent'] = $this->params['causeAgent']; // Convert this into no more than $wgUpdateRowsPerJob RefreshLinks per-title // jobs and possibly a recursive RefreshLinks job for the rest of the backlinks $jobs = BacklinkJobUtils::partitionBacklinkJob( @@ -207,7 +211,7 @@ class RefreshLinksJob extends Job { if ( $page->getTouched() >= $this->params['rootJobTimestamp'] || $opportunistic ) { // Cache is suspected to be up-to-date. As long as the cache rev ID matches // and it reflects the job's triggering change, then it is usable. - $parserOutput = ParserCache::singleton()->getDirty( $page, $parserOptions ); + $parserOutput = $services->getParserCache()->getDirty( $page, $parserOptions ); if ( !$parserOutput || $parserOutput->getCacheRevisionId() != $revision->getId() || $parserOutput->getCacheTime() < $skewedTimestamp @@ -234,7 +238,7 @@ class RefreshLinksJob extends Job { && $parserOutput->isCacheable() ) { $ctime = wfTimestamp( TS_MW, (int)$start ); // cache time - ParserCache::singleton()->save( + $services->getParserCache()->save( $parserOutput, $page, $parserOptions, $ctime, $revision->getId() ); } @@ -254,6 +258,8 @@ class RefreshLinksJob extends Job { $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); foreach ( $updates as $update ) { + // Carry over cause in case so the update can do extra logging + $update->setCause( $this->params['causeAction'], $this->params['causeAgent'] ); // FIXME: This code probably shouldn't be here? // Needed by things like Echo notifications which need // to know which user caused the links update @@ -288,10 +294,12 @@ class RefreshLinksJob extends Job { public function getDeduplicationInfo() { $info = parent::getDeduplicationInfo(); + unset( $info['causeAction'] ); + unset( $info['causeAgent'] ); if ( is_array( $info['params'] ) ) { // For per-pages jobs, the job title is that of the template that changed // (or similar), so remove that since it ruins duplicate detection - if ( isset( $info['pages'] ) ) { + if ( isset( $info['params']['pages'] ) ) { unset( $info['namespace'] ); unset( $info['title'] ); }