X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2Fjobs%2FHTMLCacheUpdateJob.php;h=7d0ada5e9744f6efe9fd321581b5e32b0faa6cec;hb=7a3eb1f3a6a33c2358f91f90ff91193c1cfb8d94;hp=4d75cb303caea62b3c85fe06ee0d816da3b1e53b;hpb=4bd87fba840a3fa2ba8c6dbcfa7f005f6708c0fa;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php index 4d75cb303c..7d0ada5e97 100644 --- a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php +++ b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php @@ -47,14 +47,16 @@ class HTMLCacheUpdateJob extends Job { // Multiple pages per job make matches unlikely !( isset( $params['pages'] ) && count( $params['pages'] ) != 1 ) ); + $this->params += [ 'causeAction' => 'unknown', 'causeAgent' => 'unknown' ]; } /** * @param Title $title Title to purge backlink pages from * @param string $table Backlink table name + * @param array $params Additional job parameters * @return HTMLCacheUpdateJob */ - public static function newForBacklinks( Title $title, $table ) { + public static function newForBacklinks( Title $title, $table, $params = [] ) { return new self( $title, [ @@ -62,7 +64,7 @@ class HTMLCacheUpdateJob extends Job { 'recursive' => true ] + Job::newRootJobParams( // "overall" refresh links job info "htmlCacheUpdate:{$table}:{$title->getPrefixedText()}" - ) + ) + $params ); } @@ -75,6 +77,11 @@ class HTMLCacheUpdateJob extends Job { // Job to purge all (or a range of) backlink pages for a page if ( !empty( $this->params['recursive'] ) ) { + // Carry over information for de-duplication + $extraParams = $this->getRootJobParams(); + // Carry over cause information for logging + $extraParams['causeAction'] = $this->params['causeAction']; + $extraParams['causeAgent'] = $this->params['causeAgent']; // Convert this into no more than $wgUpdateRowsPerJob HTMLCacheUpdateJob per-title // jobs and possibly a recursive HTMLCacheUpdateJob job for the rest of the backlinks $jobs = BacklinkJobUtils::partitionBacklinkJob( @@ -82,7 +89,7 @@ class HTMLCacheUpdateJob extends Job { $wgUpdateRowsPerJob, $wgUpdateRowsPerQuery, // jobs-per-title // Carry over information for de-duplication - [ 'params' => $this->getRootJobParams() ] + [ 'params' => $extraParams ] ); JobQueueGroup::singleton()->push( $jobs ); // Job to purge pages for a set of titles @@ -121,9 +128,7 @@ class HTMLCacheUpdateJob extends Job { // not expected to invalidate these cache entries too often. $touchTimestamp = wfTimestampNow(); // If page_touched is higher than this, then something else already bumped it after enqueue - $condTimestamp = isset( $this->params['rootJobTimestamp'] ) - ? $this->params['rootJobTimestamp'] - : $touchTimestamp; + $condTimestamp = $this->params['rootJobTimestamp'] ?? $touchTimestamp; $dbw = wfGetDB( DB_MASTER ); $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();