Http::getProxy() method to get proxy configuration
[lhc/web/wiklou.git] / includes / jobqueue / Job.php
index f7ef8a9..2d13c7e 100644 (file)
@@ -64,12 +64,17 @@ abstract class Job implements IJobSpecification {
         */
        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}'" );
        }
 
        /**
@@ -144,6 +149,14 @@ abstract class Job implements IJobSpecification {
                        : 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
         *