*/
public static function factory( $command, Title $title, $params = array() ) {
global $wgJobClasses;
+
if ( isset( $wgJobClasses[$command] ) ) {
$class = $wgJobClasses[$command];
- return new $class( $title, $params );
+ $job = new $class( $title, $params );
+ $job->command = $command;
+
+ return $job;
}
- throw new MWException( "Invalid job command `{$command}`" );
+
+ throw new InvalidArgumentException( "Invalid job command '{$command}'" );
}
/**
: null;
}
+ /**
+ * @return int|null UNIX timestamp of when the job was runnable, or null
+ * @since 1.26
+ */
+ public function getReadyTimestamp() {
+ return $this->getReleaseTimestamp() ?: $this->getQueuedTimestamp();
+ }
+
/**
* Whether the queue should reject insertion of this job if a duplicate exists
*