1 | <?php |
||
19 | class CleanupJob extends AbstractQueuedJob |
||
20 | { |
||
21 | use Configurable; |
||
22 | |||
23 | /** |
||
24 | * How we will determine "stale" |
||
25 | * Possible values: age, number |
||
26 | * @config |
||
27 | * @var string |
||
28 | */ |
||
29 | private static $cleanup_method = "age"; |
||
30 | |||
31 | /** |
||
32 | * Value associated with cleanupMethod |
||
33 | * age => days, number => integer |
||
34 | * @config |
||
35 | * @var integer |
||
36 | */ |
||
37 | private static $cleanup_value = 30; |
||
38 | |||
39 | /** |
||
40 | * Which JobStatus values are OK to be deleted |
||
41 | * @config |
||
42 | * @var array |
||
43 | */ |
||
44 | private static $cleanup_statuses = array( |
||
45 | "Complete", |
||
46 | "Broken", |
||
47 | // "Initialising", |
||
48 | // "Running", |
||
49 | // "New", |
||
50 | // "Paused", |
||
51 | // "Cancelled", |
||
52 | // "Waiting", |
||
53 | ); |
||
54 | |||
55 | /** |
||
56 | * Database query limit |
||
57 | * |
||
58 | * @config |
||
59 | * @var integer |
||
60 | */ |
||
61 | private static $query_limit = 100000; |
||
62 | |||
63 | /** |
||
64 | * Check whether is enabled or not for BC |
||
65 | * @config |
||
66 | * @var boolean |
||
67 | */ |
||
68 | private static $is_enabled = false; |
||
69 | |||
70 | /** |
||
71 | * Defines the title of the job |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getTitle() |
||
81 | |||
82 | /** |
||
83 | * Set immediacy of job |
||
84 | * @return int |
||
85 | */ |
||
86 | public function getJobType() |
||
91 | |||
92 | /** |
||
93 | * Clear out stale jobs based on the cleanup values |
||
94 | */ |
||
95 | public function process() |
||
165 | |||
166 | private function reenqueue() |
||
177 | } |
||
178 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.