From b4290a6b6b327472305c91f1c63367b92cd65c63 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 6 Nov 2018 11:53:37 -0800 Subject: [PATCH] Improve handling of invalid titles in RefreshLinksJob Run updates for as many titles as possible and mark the job as failed if a title is invalid. Set the error message used by the job executer. Bug: T208147 Change-Id: I7f5fafe9439d8a7b45166515532075202af7d013 --- includes/jobqueue/jobs/RefreshLinksJob.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index 3f922a3f6a..7f9b2a3670 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -83,6 +83,7 @@ class RefreshLinksJob extends Job { function run() { global $wgUpdateRowsPerJob; + $ok = true; // Job to update all (or a range of) backlink pages for a page if ( !empty( $this->params['recursive'] ) ) { // When the base job branches, wait for the replica DBs to catch up to the master. @@ -115,16 +116,21 @@ class RefreshLinksJob extends Job { JobQueueGroup::singleton()->push( $jobs ); // Job to update link tables for a set of titles } elseif ( isset( $this->params['pages'] ) ) { - foreach ( $this->params['pages'] as $nsAndKey ) { - list( $ns, $dbKey ) = $nsAndKey; - $this->runForTitle( Title::makeTitleSafe( $ns, $dbKey ) ); + foreach ( $this->params['pages'] as list( $ns, $dbKey ) ) { + $title = Title::makeTitleSafe( $ns, $dbKey ); + if ( $title ) { + $this->runForTitle( $title ); + } else { + $ok = false; + $this->setLastError( "Invalid title ($ns,$dbKey)." ); + } } // Job to update link tables for a given title } else { $this->runForTitle( $this->title ); } - return true; + return $ok; } /** -- 2.20.1