/** @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;
: null;
}
+ /**
+ * @return int|null UNIX timestamp of when the job was queued, or null
+ * @since 1.26
+ */
+ public function getQueuedTimestamp() {
+ return isset( $this->metadata['timestamp'] )
+ ? wfTimestampOrNull( TS_UNIX, $this->metadata['timestamp'] )
+ : null;
+ }
+
/**
* Whether the queue should reject insertion of this job if a duplicate exists
*