|
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\Tasks; |
|
10
|
|
|
|
|
11
|
|
|
use Waca\Helpers\HttpHelper; |
|
12
|
|
|
use Waca\Helpers\Interfaces\IEmailHelper; |
|
13
|
|
|
use Waca\Helpers\Interfaces\IOAuthProtocolHelper; |
|
14
|
|
|
use Waca\Helpers\IrcNotificationHelper; |
|
15
|
|
|
use Waca\PdoDatabase; |
|
16
|
|
|
use Waca\Providers\Interfaces\IAntiSpoofProvider; |
|
17
|
|
|
use Waca\Providers\Interfaces\ILocationProvider; |
|
18
|
|
|
use Waca\Providers\Interfaces\IRDnsProvider; |
|
19
|
|
|
use Waca\Providers\Interfaces\IXffTrustProvider; |
|
20
|
|
|
use Waca\Providers\TorExitProvider; |
|
21
|
|
|
use Waca\SiteConfiguration; |
|
22
|
|
|
|
|
23
|
|
|
abstract class TaskBase implements ITask |
|
24
|
|
|
{ |
|
25
|
|
|
/** @var SiteConfiguration */ |
|
26
|
|
|
private $siteConfiguration; |
|
27
|
|
|
/** @var IEmailHelper */ |
|
28
|
|
|
private $emailHelper; |
|
29
|
|
|
/** @var HttpHelper */ |
|
30
|
|
|
private $httpHelper; |
|
31
|
|
|
/** @var ILocationProvider */ |
|
32
|
|
|
private $locationProvider; |
|
33
|
|
|
/** @var IXffTrustProvider */ |
|
34
|
|
|
private $xffTrustProvider; |
|
35
|
|
|
/** @var IRDnsProvider */ |
|
36
|
|
|
private $rdnsProvider; |
|
37
|
|
|
/** @var IAntiSpoofProvider */ |
|
38
|
|
|
private $antiSpoofProvider; |
|
39
|
|
|
/** @var IOAuthProtocolHelper */ |
|
40
|
|
|
private $oauthHelper; |
|
41
|
|
|
/** @var PdoDatabase */ |
|
42
|
|
|
private $database; |
|
43
|
|
|
/** @var IrcNotificationHelper */ |
|
44
|
|
|
private $notificationHelper; |
|
45
|
|
|
/** @var TorExitProvider */ |
|
46
|
|
|
private $torExitProvider; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @return IEmailHelper |
|
50
|
|
|
*/ |
|
51
|
|
|
final public function getEmailHelper() |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->emailHelper; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param IEmailHelper $emailHelper |
|
58
|
|
|
*/ |
|
59
|
|
|
final public function setEmailHelper($emailHelper) |
|
60
|
|
|
{ |
|
61
|
|
|
$this->emailHelper = $emailHelper; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return HttpHelper |
|
66
|
|
|
*/ |
|
67
|
|
|
final public function getHttpHelper() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->httpHelper; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param HttpHelper $httpHelper |
|
74
|
|
|
*/ |
|
75
|
|
|
final public function setHttpHelper($httpHelper) |
|
76
|
|
|
{ |
|
77
|
|
|
$this->httpHelper = $httpHelper; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return ILocationProvider |
|
82
|
|
|
*/ |
|
83
|
|
|
final public function getLocationProvider() |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->locationProvider; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @param ILocationProvider $locationProvider |
|
90
|
|
|
*/ |
|
91
|
|
|
final public function setLocationProvider(ILocationProvider $locationProvider) |
|
92
|
|
|
{ |
|
93
|
|
|
$this->locationProvider = $locationProvider; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return IXffTrustProvider |
|
98
|
|
|
*/ |
|
99
|
|
|
final public function getXffTrustProvider() |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->xffTrustProvider; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @param IXffTrustProvider $xffTrustProvider |
|
106
|
|
|
*/ |
|
107
|
|
|
final public function setXffTrustProvider(IXffTrustProvider $xffTrustProvider) |
|
108
|
|
|
{ |
|
109
|
|
|
$this->xffTrustProvider = $xffTrustProvider; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return IRDnsProvider |
|
114
|
|
|
*/ |
|
115
|
|
|
final public function getRdnsProvider() |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->rdnsProvider; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @param IRDnsProvider $rdnsProvider |
|
122
|
|
|
*/ |
|
123
|
|
|
public function setRdnsProvider($rdnsProvider) |
|
124
|
|
|
{ |
|
125
|
|
|
$this->rdnsProvider = $rdnsProvider; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @return IAntiSpoofProvider |
|
130
|
|
|
*/ |
|
131
|
|
|
public function getAntiSpoofProvider() |
|
132
|
|
|
{ |
|
133
|
|
|
return $this->antiSpoofProvider; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* @param IAntiSpoofProvider $antiSpoofProvider |
|
138
|
|
|
*/ |
|
139
|
|
|
public function setAntiSpoofProvider($antiSpoofProvider) |
|
140
|
|
|
{ |
|
141
|
|
|
$this->antiSpoofProvider = $antiSpoofProvider; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @return PdoDatabase |
|
146
|
|
|
*/ |
|
147
|
|
|
final public function getDatabase() |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->database; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @param PdoDatabase $database |
|
154
|
|
|
*/ |
|
155
|
|
|
final public function setDatabase($database) |
|
156
|
|
|
{ |
|
157
|
|
|
$this->database = $database; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @return IOAuthProtocolHelper |
|
162
|
|
|
*/ |
|
163
|
|
|
public function getOAuthProtocolHelper() |
|
164
|
|
|
{ |
|
165
|
|
|
return $this->oauthHelper; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @param IOAuthProtocolHelper $oauthProtocolHelper |
|
170
|
|
|
*/ |
|
171
|
|
|
public function setOAuthProtocolHelper($oauthProtocolHelper) |
|
172
|
|
|
{ |
|
173
|
|
|
$this->oauthHelper = $oauthProtocolHelper; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @return void |
|
178
|
|
|
*/ |
|
179
|
|
|
abstract public function execute(); |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @return IrcNotificationHelper |
|
183
|
|
|
*/ |
|
184
|
|
|
public function getNotificationHelper() |
|
185
|
|
|
{ |
|
186
|
|
|
return $this->notificationHelper; |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* @param IrcNotificationHelper $notificationHelper |
|
191
|
|
|
*/ |
|
192
|
|
|
public function setNotificationHelper($notificationHelper) |
|
193
|
|
|
{ |
|
194
|
|
|
$this->notificationHelper = $notificationHelper; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
/** |
|
198
|
|
|
* @return TorExitProvider |
|
199
|
|
|
*/ |
|
200
|
|
|
public function getTorExitProvider() |
|
201
|
|
|
{ |
|
202
|
|
|
return $this->torExitProvider; |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
/** |
|
206
|
|
|
* @param TorExitProvider $torExitProvider |
|
207
|
|
|
*/ |
|
208
|
|
|
public function setTorExitProvider($torExitProvider) |
|
209
|
|
|
{ |
|
210
|
|
|
$this->torExitProvider = $torExitProvider; |
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* Gets the site configuration object |
|
215
|
|
|
* |
|
216
|
|
|
* @return SiteConfiguration |
|
217
|
|
|
*/ |
|
218
|
|
|
final protected function getSiteConfiguration() |
|
219
|
|
|
{ |
|
220
|
|
|
return $this->siteConfiguration; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* Sets the site configuration object for this page |
|
225
|
|
|
* |
|
226
|
|
|
* @param SiteConfiguration $configuration |
|
227
|
|
|
*/ |
|
228
|
|
|
final public function setSiteConfiguration($configuration) |
|
229
|
|
|
{ |
|
230
|
|
|
$this->siteConfiguration = $configuration; |
|
231
|
|
|
} |
|
232
|
|
|
} |