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\Title\Title; |
24 | |
25 | /** |
26 | * API module to stabilize pages |
27 | * |
28 | * @ingroup FlaggedRevs |
29 | */ |
30 | abstract class ApiStabilize extends ApiBase { |
31 | |
32 | /** @var Title|null */ |
33 | protected $title; |
34 | |
35 | /** |
36 | * @inheritDoc |
37 | */ |
38 | public function execute() { |
39 | $params = $this->extractRequestParams(); |
40 | $user = $this->getUser(); |
41 | |
42 | $this->title = Title::newFromText( $params['title'] ); |
43 | if ( $this->title == null ) { |
44 | $this->dieWithError( |
45 | [ 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ] |
46 | ); |
47 | } |
48 | |
49 | $errors = $this->getPermissionManager() |
50 | ->getPermissionErrors( 'stablesettings', $user, $this->title ); |
51 | if ( $errors ) { |
52 | $this->dieStatus( $this->errorArrayToStatus( $errors, $user ) ); |
53 | } |
54 | |
55 | $this->doExecute(); // child class |
56 | } |
57 | |
58 | abstract public function doExecute(); |
59 | |
60 | /** |
61 | * @inheritDoc |
62 | */ |
63 | public function isWriteMode() { |
64 | return true; |
65 | } |
66 | |
67 | /** |
68 | * @return string |
69 | */ |
70 | public function needsToken() { |
71 | return 'csrf'; |
72 | } |
73 | } |