X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobSpecification.php;h=80a46d04baaedaa021ea4cc0bf04a675c358d27b;hb=447574ceb746c2f4026a8bf77632bdc4604314bb;hp=4abbc6db2fbd5f53bf234873491fad8adfd6cc46;hpb=b6a1f3bc774d043c69e9ed2875210049cdda9d68;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobSpecification.php b/includes/jobqueue/JobSpecification.php index 4abbc6db2f..80a46d04ba 100644 --- a/includes/jobqueue/JobSpecification.php +++ b/includes/jobqueue/JobSpecification.php @@ -28,8 +28,7 @@ * $job = new JobSpecification( * 'null', * array( 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ), - * array( 'removeDuplicates' => 1 ), - * Title::makeTitle( NS_SPECIAL, 'nullity' ) + * array( 'removeDuplicates' => 1 ) * ); * JobQueueGroup::singleton()->push( $job ) * @endcode @@ -63,8 +62,19 @@ class JobSpecification implements IJobSpecification { $this->validateParams( $opts ); $this->type = $type; + if ( $title instanceof Title ) { + // Make sure JobQueue classes can pull the title from parameters alone + if ( $title->getDBkey() !== '' ) { + $params += [ + 'namespace' => $title->getNamespace(), + 'title' => $title->getDBkey() + ]; + } + } else { + $title = Title::makeTitle( NS_SPECIAL, '' ); + } $this->params = $params; - $this->title = $title ?: Title::makeTitle( NS_SPECIAL, 'Badtitle/' . static::class ); + $this->title = $title; $this->opts = $opts; }