Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
ApiStabilize | |
0.00% |
0 / 14 |
|
0.00% |
0 / 3 |
30 | |
0.00% |
0 / 1 |
execute | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
12 | |||
doExecute | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
isWriteMode | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
needsToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * Created on Sep 19, 2009 |
4 | * |
5 | * API module for MediaWiki's FlaggedRevs extension |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License along |
18 | * with this program; if not, write to the Free Software Foundation, Inc., |
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | * http://www.gnu.org/copyleft/gpl.html |
21 | */ |
22 | |
23 | use MediaWiki\Api\ApiBase; |
24 | use MediaWiki\Title\Title; |
25 | |
26 | /** |
27 | * API module to stabilize pages |
28 | * |
29 | * @ingroup FlaggedRevs |
30 | */ |
31 | abstract class ApiStabilize extends ApiBase { |
32 | |
33 | /** @var Title|null */ |
34 | protected $title; |
35 | |
36 | /** |
37 | * @inheritDoc |
38 | */ |
39 | public function execute() { |
40 | $params = $this->extractRequestParams(); |
41 | $user = $this->getUser(); |
42 | |
43 | $this->title = Title::newFromText( $params['title'] ); |
44 | if ( $this->title == null ) { |
45 | $this->dieWithError( |
46 | [ 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ] |
47 | ); |
48 | } |
49 | |
50 | $status = $this->getPermissionManager() |
51 | ->getPermissionStatus( 'stablesettings', $user, $this->title ); |
52 | if ( !$status->isGood() ) { |
53 | $this->dieStatus( $status ); |
54 | } |
55 | |
56 | $this->doExecute(); // child class |
57 | } |
58 | |
59 | abstract public function doExecute(); |
60 | |
61 | /** |
62 | * @inheritDoc |
63 | */ |
64 | public function isWriteMode() { |
65 | return true; |
66 | } |
67 | |
68 | /** |
69 | * @return string |
70 | */ |
71 | public function needsToken() { |
72 | return 'csrf'; |
73 | } |
74 | } |