X-Git-Url: http://git.cyclocoop.org/%28?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobSpecification.php;h=19ff9677eafb9fdf802e7d1ab2999660a4b69f0d;hb=509b2f7fe247bfe89c6bedd21d4bfd22d435aa4d;hp=b04aa838082ac32bc00fd93b2ab730582c8ca9b1;hpb=1dfd59a4e3d4f9c20bbe584bd1ad7a622c22f823;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobSpecification.php b/includes/jobqueue/JobSpecification.php index b04aa83808..19ff9677ea 100644 --- a/includes/jobqueue/JobSpecification.php +++ b/includes/jobqueue/JobSpecification.php @@ -27,9 +27,8 @@ * @code * $job = new JobSpecification( * 'null', - * array( 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ), - * array( 'removeDuplicates' => 1 ), - * Title::makeTitle( NS_SPECIAL, 'nullity' ) + * [ 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ], + * [ '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, 'Blankpage' ); + $this->title = $title; $this->opts = $opts; }