Merge "jquery.tablesorter: Fix pre-JS selector to match wikitext-generated sortable...
[lhc/web/wiklou.git] / includes / jobqueue / JobSpecification.php
index d060c1c..80a46d0 100644 (file)
  * @file
  */
 
-/**
- * Job queue task description interface
- *
- * @ingroup JobQueue
- * @since 1.23
- */
-interface IJobSpecification {
-       /**
-        * @return string Job type
-        */
-       public function getType();
-
-       /**
-        * @return array
-        */
-       public function getParams();
-
-       /**
-        * @return int|null UNIX timestamp to delay running this job until, otherwise null
-        */
-       public function getReleaseTimestamp();
-
-       /**
-        * @return bool Whether only one of each identical set of jobs should be run
-        */
-       public function ignoreDuplicates();
-
-       /**
-        * Subclasses may need to override this to make duplication detection work.
-        * The resulting map conveys everything that makes the job unique. This is
-        * only checked if ignoreDuplicates() returns true, meaning that duplicate
-        * jobs are supposed to be ignored.
-        *
-        * @return array Map of key/values
-        */
-       public function getDeduplicationInfo();
-
-       /**
-        * @see JobQueue::deduplicateRootJob()
-        * @return array
-        * @since 1.26
-        */
-       public function getRootJobParams();
-
-       /**
-        * @see JobQueue::deduplicateRootJob()
-        * @return bool
-        * @since 1.22
-        */
-       public function hasRootJobParams();
-
-       /**
-        * @see JobQueue::deduplicateRootJob()
-        * @return bool Whether this is job is a root job
-        */
-       public function isRootJob();
-
-       /**
-        * @return Title Descriptive title (this can simply be informative)
-        */
-       public function getTitle();
-}
-
 /**
  * Job queue task description base code
  *
@@ -91,8 +28,7 @@ interface IJobSpecification {
  * $job = new JobSpecification(
  *             'null',
  *             array( 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ),
- *             array( 'removeDuplicates' => 1 ),
- *             Title::makeTitle( NS_SPECIAL, 'nullity' )
+ *             array( 'removeDuplicates' => 1 )
  * );
  * JobQueueGroup::singleton()->push( $job )
  * @endcode
@@ -126,8 +62,19 @@ class JobSpecification implements IJobSpecification {
                $this->validateParams( $opts );
 
                $this->type = $type;
+               if ( $title instanceof Title ) {
+                       // Make sure JobQueue classes can pull the title from parameters alone
+                       if ( $title->getDBkey() !== '' ) {
+                               $params += [
+                                       'namespace' => $title->getNamespace(),
+                                       'title' => $title->getDBkey()
+                               ];
+                       }
+               } else {
+                       $title = Title::makeTitle( NS_SPECIAL, '' );
+               }
                $this->params = $params;
-               $this->title = $title ?: Title::makeTitle( NS_SPECIAL, 'Badtitle/' . static::class );
+               $this->title = $title;
                $this->opts = $opts;
        }