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\Pages\RequestAction; |
10
|
|
|
|
11
|
|
|
use Waca\Exceptions\ApplicationLogicException; |
12
|
|
|
use Waca\Exceptions\OptimisticLockFailedException; |
13
|
|
|
use Waca\Helpers\Logger; |
14
|
|
|
use Waca\WebRequest; |
15
|
|
|
|
16
|
|
|
class PageManuallyConfirm extends RequestActionBase |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* This endpoint manually confirms a request, bypassing email confirmation. |
20
|
|
|
* |
21
|
|
|
* Only administrators are allowed to do this, for obvious reasons. |
22
|
|
|
* |
23
|
|
|
* @throws ApplicationLogicException|OptimisticLockFailedException |
24
|
|
|
*/ |
25
|
|
|
protected function main() |
26
|
|
|
{ |
27
|
|
|
// This method throws an error if we don't post |
28
|
|
|
$this->checkPosted(); |
29
|
|
|
|
30
|
|
|
// Retrieve the database. |
31
|
|
|
$database = $this->getDatabase(); |
32
|
|
|
|
33
|
|
|
// Find the request |
34
|
|
|
// This method throws exceptions if there is an error with the request. |
35
|
|
|
$request = $this->getRequest($database); |
36
|
|
|
$version = WebRequest::postInt('version'); |
37
|
|
|
|
38
|
|
|
$request->setUpdateVersion($version); |
39
|
|
|
|
40
|
|
|
// Mark the request as confirmed. |
41
|
|
|
$request->setEmailConfirm("Confirmed"); |
42
|
|
|
$request->save(); |
43
|
|
|
|
44
|
|
|
// Log that the request was manually confirmed |
45
|
|
|
Logger::manuallyConfirmRequest($database, $request); |
46
|
|
|
|
47
|
|
|
// Notify the IRC channel |
48
|
|
|
$this->getNotificationHelper()->requestReceived($request); |
49
|
|
|
|
50
|
|
|
// Redirect back to the main request, now it should show the request. |
51
|
|
|
$this->redirect('viewRequest', null, array('id' => $request->getId())); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|