X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2Fjobs%2FHTMLCacheUpdateJob.php;h=34028df172759a0cd329feeeadb4cb9b1ae78795;hb=07a791ffd1d80c6a8f2ca4dfdbc3f2002ac869fe;hp=0aa33cac18fbaa0c75ab9ac84224197faf9808c6;hpb=17e88d99eb768e4181207bbd35656d239ef5d4e8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/jobs/HTMLCacheUpdateJob.php b/includes/jobqueue/jobs/HTMLCacheUpdateJob.php index 0aa33cac18..34028df172 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 @@ -103,7 +110,7 @@ class HTMLCacheUpdateJob extends Job { * @param array $pages Map of (page ID => (namespace, DB key)) entries */ protected function invalidateTitles( array $pages ) { - global $wgUpdateRowsPerQuery, $wgUseFileCache; + global $wgUpdateRowsPerQuery, $wgUseFileCache, $wgPageLanguageUseDB; // Get all page IDs in this query into an array $pageIds = array_keys( $pages ); @@ -145,7 +152,10 @@ class HTMLCacheUpdateJob extends Job { // Get the list of affected pages (races only mean something else did the purge) $titleArray = TitleArray::newFromResult( $dbw->select( 'page', - [ 'page_namespace', 'page_title' ], + array_merge( + [ 'page_namespace', 'page_title' ], + $wgPageLanguageUseDB ? [ 'page_lang' ] : [] + ), [ 'page_id' => $pageIds, 'page_touched' => $dbw->timestamp( $touchTimestamp ) ], __METHOD__ ) ); @@ -166,6 +176,20 @@ class HTMLCacheUpdateJob extends Job { } } + public function getDeduplicationInfo() { + $info = parent::getDeduplicationInfo(); + 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['params']['pages'] ) ) { + unset( $info['namespace'] ); + unset( $info['title'] ); + } + } + + return $info; + } + public function workItemCount() { if ( !empty( $this->params['recursive'] ) ) { return 0; // nothing actually purged