1
|
|
|
<?php |
2
|
|
|
/****************************************************************************** |
3
|
|
|
* Wikipedia Account Creation Assistance tool * |
4
|
|
|
* * |
5
|
|
|
* All code in this file is released into the public domain by the ACC * |
6
|
|
|
* Development Team. Please see team.json for a list of contributors. * |
7
|
|
|
******************************************************************************/ |
8
|
|
|
|
9
|
|
|
namespace Waca\Helpers\SearchHelpers; |
10
|
|
|
|
11
|
|
|
use Waca\DataObjects\JobQueue; |
12
|
|
|
use Waca\PdoDatabase; |
13
|
|
|
|
14
|
|
|
class JobQueueSearchHelper extends SearchHelperBase |
15
|
|
|
{ |
16
|
|
|
protected function __construct(PdoDatabase $database) |
17
|
|
|
{ |
18
|
|
|
parent::__construct($database, 'jobqueue', JobQueue::class, null); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param PdoDatabase $database |
23
|
|
|
* |
24
|
|
|
* @return JobQueueSearchHelper |
25
|
|
|
*/ |
26
|
|
|
public static function get(PdoDatabase $database) { |
27
|
|
|
$helper = new JobQueueSearchHelper($database); |
28
|
|
|
return $helper; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param string[] $statuses |
33
|
|
|
* |
34
|
|
|
* @return $this |
35
|
|
|
*/ |
36
|
|
|
public function statusIn($statuses) { |
37
|
|
|
$this->inClause('status', $statuses); |
38
|
|
|
|
39
|
|
|
return $this; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return $this |
44
|
|
|
*/ |
45
|
|
|
public function notAcknowledged() { |
46
|
|
|
$this->whereClause .= ' AND (acknowledged IS NULL OR acknowledged = 0)'; |
47
|
|
|
|
48
|
|
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function byTask($task) { |
52
|
|
|
$this->whereClause .= ' AND task = ?'; |
53
|
|
|
$this->parameterList[] = $task; |
54
|
|
|
|
55
|
|
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function byUser($userId) { |
59
|
|
|
$this->whereClause .= ' AND user = ?'; |
60
|
|
|
$this->parameterList[] = $userId; |
61
|
|
|
|
62
|
|
|
return $this; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function byStatus($status) { |
66
|
|
|
$this->whereClause .= ' AND status = ?'; |
67
|
|
|
$this->parameterList[] = $status; |
68
|
|
|
|
69
|
|
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function byRequest($request) |
73
|
|
|
{ |
74
|
|
|
$this->whereClause .= ' AND request = ?'; |
75
|
|
|
$this->parameterList[] = $request; |
76
|
|
|
|
77
|
|
|
return $this; |
78
|
|
|
} |
79
|
|
|
} |