X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjob%2FJob.php;h=77652a4d4eebb02a0c534174f1c9a9eed920bf25;hb=85661d9653b1f24ede88021c6f08ad1c28abed6f;hp=03595401091bbc3c49a751a33a8c1e887f8daa76;hpb=c47d559a4894630fc0fe2ffe06004ca55b9dc99f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/job/Job.php b/includes/job/Job.php index 0359540109..77652a4d4e 100644 --- a/includes/job/Job.php +++ b/includes/job/Job.php @@ -28,27 +28,31 @@ * @ingroup JobQueue */ abstract class Job { - /** - * @var Title - */ - var $title; + /** @var string */ + public $command; - var $command, - $params, - $id, - $removeDuplicates, - $error; + /** @var array|bool Array of job parameters or false if none */ + public $params; - /** @var Array Additional queue metadata */ + /** @var array Additional queue metadata */ public $metadata = array(); + /** @var Title */ + protected $title; + + /** @var bool Expensive jobs may set this to true */ + protected $removeDuplicates; + + /** @var string Text for error that occurred last */ + protected $error; + /*------------------------------------------------------------------------- * Abstract functions *------------------------------------------------------------------------*/ /** * Run the job - * @return boolean success + * @return bool Success */ abstract public function run(); @@ -60,18 +64,17 @@ abstract class Job { * Create the appropriate object to handle a specific job * * @param string $command Job command - * @param $title Title: Associated title + * @param Title $title Associated title * @param array|bool $params Job parameters - * @param int $id Job identifier * @throws MWException * @return Job */ - public static function factory( $command, Title $title, $params = false, $id = 0 ) { + public static function factory( $command, Title $title, $params = false ) { global $wgJobClasses; if ( isset( $wgJobClasses[$command] ) ) { $class = $wgJobClasses[$command]; - return new $class( $title, $params, $id ); + return new $class( $title, $params ); } throw new MWException( "Invalid job command `{$command}`" ); } @@ -123,7 +126,7 @@ abstract class Job { * Pop a job off the front of the queue. * This is subject to $wgJobTypesExcludedFromDefaultQueue. * - * @return Job or false if there's no jobs + * @return Job|bool False if there are no jobs * @deprecated since 1.21 */ public static function pop() { @@ -138,23 +141,14 @@ abstract class Job { * @param $command * @param $title * @param $params array|bool - * @param $id int */ - public function __construct( $command, $title, $params = false, $id = 0 ) { + public function __construct( $command, $title, $params = false ) { $this->command = $command; $this->title = $title; $this->params = $params; - $this->id = $id; - $this->removeDuplicates = false; // expensive jobs may set this to true - } - - /** - * @return integer May be 0 for jobs stored outside the DB - * @deprecated since 1.22 - */ - public function getId() { - return $this->id; + // expensive jobs may set this to true + $this->removeDuplicates = false; } /** @@ -179,7 +173,7 @@ abstract class Job { } /** - * @return integer|null UNIX timestamp to delay running this job until, otherwise null + * @return int|null UNIX timestamp to delay running this job until, otherwise null * @since 1.22 */ public function getReleaseTimestamp() { @@ -209,7 +203,7 @@ abstract class Job { * only checked if ignoreDuplicates() returns true, meaning that duplicate * jobs are supposed to be ignored. * - * @return Array Map of key/values + * @return array Map of key/values * @since 1.21 */ public function getDeduplicationInfo() { @@ -233,7 +227,9 @@ abstract class Job { /** * @see JobQueue::deduplicateRootJob() * @param string $key A key that identifies the task - * @return Array + * @return array Map of: + * - rootJobSignature : hash (e.g. SHA1) that identifies the task + * - rootJobTimestamp : TS_MW timestamp of this instance of the task * @since 1.21 */ public static function newRootJobParams( $key ) { @@ -245,7 +241,7 @@ abstract class Job { /** * @see JobQueue::deduplicateRootJob() - * @return Array + * @return array * @since 1.21 */ public function getRootJobParams() {