/** @var string */
public $command;
- /** @var array|bool Array of job parameters or false if none */
+ /** @var array Array of job parameters */
public $params;
/** @var array Additional queue metadata */
*
* @param string $command Job command
* @param Title $title Associated title
- * @param array|bool $params Job parameters
+ * @param array $params Job parameters
* @throws MWException
* @return Job
*/
- public static function factory( $command, Title $title, $params = false ) {
+ public static function factory( $command, Title $title, $params = array() ) {
global $wgJobClasses;
if ( isset( $wgJobClasses[$command] ) ) {
$class = $wgJobClasses[$command];
public function __construct( $command, $title, $params = false ) {
$this->command = $command;
$this->title = $title;
- $this->params = $params;
+ $this->params = is_array( $params ) ? $params : array(); // sanity
// expensive jobs may set this to true
$this->removeDuplicates = false;
* @since 1.26
*/
class ActivityUpdateJob extends Job {
- function __construct( $title, $params ) {
+ function __construct( Title $title, array $params ) {
parent::__construct( 'activityUpdateJob', $title, $params );
if ( !isset( $params['type'] ) ) {
* @ingroup Upload
*/
class AssembleUploadChunksJob extends Job {
- public function __construct( $title, $params ) {
+ public function __construct( Title $title, array $params ) {
parent::__construct( 'AssembleUploadChunks', $title, $params );
$this->removeDuplicates = true;
}
/** @var User */
private static $user;
+ /**
+ * @param Title $title
+ * @param array $params
+ */
+ function __construct( Title $title, array $params ) {
+ parent::__construct( 'fixDoubleRedirect', $title, $params );
+ $this->reason = $params['reason'];
+ $this->redirTitle = Title::newFromText( $params['redirTitle'] );
+ }
+
/**
* Insert jobs into the job queue to fix redirects to the given title
* @param string $reason The reason for the fix, see message
JobQueueGroup::singleton()->push( $jobs );
}
- /**
- * @param Title $title
- * @param array|bool $params
- */
- function __construct( $title, $params = false ) {
- parent::__construct( 'fixDoubleRedirect', $title, $params );
- $this->reason = $params['reason'];
- $this->redirTitle = Title::newFromText( $params['redirTitle'] );
- }
-
/**
* @return bool
*/
* @param Title $title
* @param array $params Job parameters
*/
- function __construct( $title, $params ) {
+ function __construct( Title $title, array $params ) {
parent::__construct( 'duplicate', $title, $params );
}
* @ingroup JobQueue
*/
class EmaillingJob extends Job {
- function __construct( $title, $params ) {
+ function __construct( Title $title = null, array $params ) {
parent::__construct( 'sendMail', Title::newMainPage(), $params );
}
* @ingroup JobQueue
*/
class EnotifNotifyJob extends Job {
- function __construct( $title, $params ) {
+ function __construct( Title $title, array $params ) {
parent::__construct( 'enotifNotify', $title, $params );
}
* @param Title $title
* @param array $params Job parameters
*/
- function __construct( $title, $params ) {
+ function __construct( Title $title, array $params ) {
parent::__construct( 'enqueue', $title, $params );
}
* @ingroup JobQueue
*/
class HTMLCacheUpdateJob extends Job {
- function __construct( $title, $params = '' ) {
+ function __construct( Title $title, array $params ) {
parent::__construct( 'htmlCacheUpdate', $title, $params );
// Base backlink purge jobs can be de-duplicated
$this->removeDuplicates = ( !isset( $params['range'] ) && !isset( $params['pages'] ) );
* @param Title $title
* @param array $params Job parameters (lives, usleep)
*/
- function __construct( $title, $params ) {
+ function __construct( Title $title, array $params ) {
parent::__construct( 'null', $title, $params );
if ( !isset( $this->params['lives'] ) ) {
$this->params['lives'] = 1;
* @ingroup JobQueue
*/
class PublishStashedFileJob extends Job {
- public function __construct( $title, $params ) {
+ public function __construct( Title $title, array $params ) {
parent::__construct( 'PublishStashedFile', $title, $params );
$this->removeDuplicates = true;
}
* @since 1.25
*/
class RecentChangesUpdateJob extends Job {
- function __construct( $title, $params ) {
+ function __construct( Title $title, array $params ) {
parent::__construct( 'recentChangesUpdate', $title, $params );
if ( !isset( $params['type'] ) ) {
const CLOCK_FUDGE = 10;
- function __construct( $title, $params = '' ) {
+ function __construct( Title $title, array $params ) {
parent::__construct( 'refreshLinks', $title, $params );
// A separate type is used just for cascade-protected backlinks
if ( !empty( $this->params['prioritize'] ) ) {
* @ingroup JobQueue
*/
class ThumbnailRenderJob extends Job {
- public function __construct( $title, $params ) {
+ public function __construct( Title $title, array $params ) {
parent::__construct( 'ThumbnailRender', $title, $params );
}
/** @var User */
protected $user;
- public function __construct( $title, $params ) {
+ public function __construct( Title $title, array $params ) {
parent::__construct( 'uploadFromUrl', $title, $params );
}
$file = $this->getLocalFile();
foreach ( $sizes as $size ) {
- if ( $file->isVectorized()
- || $file->getWidth() > $size ) {
- $jobs[] = new ThumbnailRenderJob( $file->getTitle(), array(
- 'transformParams' => array( 'width' => $size ),
- ) );
+ if ( $file->isVectorized() || $file->getWidth() > $size ) {
+ $jobs[] = new ThumbnailRenderJob(
+ $file->getTitle(),
+ array( 'transformParams' => array( 'width' => $size ) )
+ );
}
}