Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 */
20
21/**
22 * Interface for serializable objects that describe a job queue task
23 *
24 * A job specification can be inserted into a queue via JobQueue::push().
25 * The specification parameters should be JSON serializable (e.g. no PHP classes).
26 * Whatever queue the job specification is pushed into is assumed to have job runners
27 * that will eventually pop the job specification from the queue, construct a RunnableJob
28 * instance from the specification, and then execute that instance via RunnableJob::run().
29 *
30 * Job classes must have a constructor that takes a Title and a parameter array, except
31 * when they also implement GenericParameterJob in which case they must only take an array.
32 * When reconstructing the job from the job queue, the value returned from getParams() will
33 * be passed in as the constructor's array parameter; the title will be constructed from
34 * the parameter array's `namespace` and `title` fields (when these are omitted, some
35 * fallback title will be used).
36 *
37 * @ingroup JobQueue
38 * @since 1.23
39 */
40interface IJobSpecification {
41    /**
42     * @return string Job type that defines what sort of changes this job makes
43     */
44    public function getType();
45
46    /**
47     * @return array Parameters that specify sources, targets, and options for execution
48     */
49    public function getParams();
50
51    /**
52     * @return int|null UNIX timestamp to delay running this job until, otherwise null
53     */
54    public function getReleaseTimestamp();
55
56    /**
57     * @return bool Whether only one of each identical set of jobs should be run
58     */
59    public function ignoreDuplicates();
60
61    /**
62     * Subclasses may need to override this to make duplication detection work.
63     * The resulting map conveys everything that makes the job unique. This is
64     * only checked if ignoreDuplicates() returns true, meaning that duplicate
65     * jobs are supposed to be ignored.
66     *
67     * @return array Map of key/values
68     */
69    public function getDeduplicationInfo();
70
71    /**
72     * @see JobQueue::deduplicateRootJob()
73     * @return array
74     * @since 1.26
75     */
76    public function getRootJobParams();
77
78    /**
79     * @see JobQueue::deduplicateRootJob()
80     * @return bool
81     * @since 1.22
82     */
83    public function hasRootJobParams();
84
85    /**
86     * @see JobQueue::deduplicateRootJob()
87     * @return bool Whether this is job is a root job
88     */
89    public function isRootJob();
90}