X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobSpecification.php;h=80a46d04baaedaa021ea4cc0bf04a675c358d27b;hb=447574ceb746c2f4026a8bf77632bdc4604314bb;hp=d060c1cf65b309ad8859440d695220f8f4d8aa1e;hpb=97af92da48f0d434cf4b541e7a3f2d96619a95b2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobSpecification.php b/includes/jobqueue/JobSpecification.php index d060c1cf65..80a46d04ba 100644 --- a/includes/jobqueue/JobSpecification.php +++ b/includes/jobqueue/JobSpecification.php @@ -20,69 +20,6 @@ * @file */ -/** - * Job queue task description interface - * - * @ingroup JobQueue - * @since 1.23 - */ -interface IJobSpecification { - /** - * @return string Job type - */ - public function getType(); - - /** - * @return array - */ - public function getParams(); - - /** - * @return int|null UNIX timestamp to delay running this job until, otherwise null - */ - public function getReleaseTimestamp(); - - /** - * @return bool Whether only one of each identical set of jobs should be run - */ - public function ignoreDuplicates(); - - /** - * Subclasses may need to override this to make duplication detection work. - * The resulting map conveys everything that makes the job unique. This is - * only checked if ignoreDuplicates() returns true, meaning that duplicate - * jobs are supposed to be ignored. - * - * @return array Map of key/values - */ - public function getDeduplicationInfo(); - - /** - * @see JobQueue::deduplicateRootJob() - * @return array - * @since 1.26 - */ - public function getRootJobParams(); - - /** - * @see JobQueue::deduplicateRootJob() - * @return bool - * @since 1.22 - */ - public function hasRootJobParams(); - - /** - * @see JobQueue::deduplicateRootJob() - * @return bool Whether this is job is a root job - */ - public function isRootJob(); - - /** - * @return Title Descriptive title (this can simply be informative) - */ - public function getTitle(); -} - /** * Job queue task description base code * @@ -91,8 +28,7 @@ interface IJobSpecification { * $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 @@ -126,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; }