* $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
$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;
}