MediaWiki  1.23.13
JobSpecification.php
Go to the documentation of this file.
1 <?php
30 interface IJobSpecification {
34  public function getType();
35 
39  public function getParams();
40 
44  public function getReleaseTimestamp();
45 
49  public function ignoreDuplicates();
50 
59  public function getDeduplicationInfo();
60 
64  public function getTitle();
65 }
66 
86  protected $type;
87 
89  protected $params;
90 
92  protected $title;
93 
95  protected $ignoreDuplicates;
96 
103  public function __construct(
104  $type, array $params, array $opts = array(), Title $title = null
105  ) {
106  $this->validateParams( $params );
107 
108  $this->type = $type;
109  $this->params = $params;
110  $this->title = $title ?: Title::newMainPage();
111  $this->ignoreDuplicates = !empty( $opts['removeDuplicates'] );
112  }
113 
117  protected function validateParams( array $params ) {
118  foreach ( $params as $p => $v ) {
119  if ( is_array( $v ) ) {
120  $this->validateParams( $v );
121  } elseif ( !is_scalar( $v ) && $v !== null ) {
122  throw new UnexpectedValueException( "Job parameter $p is not JSON serializable." );
123  }
124  }
125  }
126 
130  public function getType() {
131  return $this->type;
132  }
133 
137  public function getTitle() {
138  return $this->title;
139  }
140 
144  public function getParams() {
145  return $this->params;
146  }
147 
151  public function getReleaseTimestamp() {
152  return isset( $this->params['jobReleaseTimestamp'] )
153  ? wfTimestampOrNull( TS_UNIX, $this->params['jobReleaseTimestamp'] )
154  : null;
155  }
156 
160  public function ignoreDuplicates() {
162  }
163 
172  public function getDeduplicationInfo() {
173  $info = array(
174  'type' => $this->getType(),
175  'namespace' => $this->getTitle()->getNamespace(),
176  'title' => $this->getTitle()->getDBkey(),
177  'params' => $this->getParams()
178  );
179  if ( is_array( $info['params'] ) ) {
180  // Identical jobs with different "root" jobs should count as duplicates
181  unset( $info['params']['rootJobSignature'] );
182  unset( $info['params']['rootJobTimestamp'] );
183  // Likewise for jobs with different delay times
184  unset( $info['params']['jobReleaseTimestamp'] );
185  }
186 
187  return $info;
188  }
189 }
JobSpecification\getTitle
getTitle()
Definition: JobSpecification.php:133
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
Title\newMainPage
static newMainPage()
Create a new Title for the Main Page.
Definition: Title.php:441
IJobSpecification\getTitle
getTitle()
JobSpecification\getType
getType()
Definition: JobSpecification.php:126
JobSpecification\getReleaseTimestamp
getReleaseTimestamp()
Definition: JobSpecification.php:147
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2703
IJobSpecification\getType
getType()
wfTimestampOrNull
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
Definition: GlobalFunctions.php:2548
IJobSpecification\getReleaseTimestamp
getReleaseTimestamp()
JobSpecification\ignoreDuplicates
ignoreDuplicates()
Definition: JobSpecification.php:156
JobSpecification\getParams
getParams()
Definition: JobSpecification.php:140
IJobSpecification\getParams
getParams()
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
JobSpecification\$params
array $params
Array of job parameters or false if none *.
Definition: JobSpecification.php:87
IJobSpecification\getDeduplicationInfo
getDeduplicationInfo()
Subclasses may need to override this to make duplication detection work.
JobSpecification\validateParams
validateParams(array $params)
Definition: JobSpecification.php:113
Title
Represents a title within MediaWiki.
Definition: Title.php:35
JobSpecification\$type
string $type
Definition: JobSpecification.php:85
JobSpecification\__construct
__construct( $type, array $params, array $opts=array(), Title $title=null)
Definition: JobSpecification.php:99
type
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
Definition: postgres.txt:22
TS_UNIX
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
Definition: GlobalFunctions.php:2473
JobSpecification
Job queue task description base code.
Definition: JobSpecification.php:84
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
IJobSpecification\ignoreDuplicates
ignoreDuplicates()
JobSpecification\$ignoreDuplicates
bool $ignoreDuplicates
Expensive jobs may set this to true *.
Definition: JobSpecification.php:91
JobSpecification\$title
Title $title
Definition: JobSpecification.php:89
JobSpecification\getDeduplicationInfo
getDeduplicationInfo()
Subclasses may need to override this to make duplication detection work.
Definition: JobSpecification.php:168
IJobSpecification
Job queue task description interface.
Definition: JobSpecification.php:30