Index: trunk/extensions/FlaggedRevs/api/ApiStabilize.php |
— | — | @@ -27,6 +27,10 @@ |
28 | 28 | * @ingroup FlaggedRevs |
29 | 29 | */ |
30 | 30 | abstract class ApiStabilize extends ApiBase { |
| 31 | + |
| 32 | + // Title param |
| 33 | + protected $title; |
| 34 | + |
31 | 35 | public function execute() { |
32 | 36 | global $wgUser; |
33 | 37 | $params = $this->extractRequestParams(); |
— | — | @@ -37,11 +41,11 @@ |
38 | 42 | $this->dieUsageMsg( array( 'missingparam', 'token' ) ); |
39 | 43 | } |
40 | 44 | |
41 | | - $title = Title::newFromText( $params['title'] ); |
42 | | - if ( $title == null ) { |
| 45 | + $this->title = Title::newFromText( $params['title'] ); |
| 46 | + if ( $this->title == null ) { |
43 | 47 | $this->dieUsage( "Invalid title given.", "invalidtitle" ); |
44 | 48 | } |
45 | | - $errors = $title->getUserPermissionsErrors( 'stablesettings', $wgUser ); |
| 49 | + $errors = $this->title->getUserPermissionsErrors( 'stablesettings', $wgUser ); |
46 | 50 | if ( $errors ) { |
47 | 51 | // We don't care about multiple errors, just report one of them |
48 | 52 | $this->dieUsageMsg( reset( $errors ) ); |
— | — | @@ -80,7 +84,7 @@ |
81 | 85 | $params = $this->extractRequestParams(); |
82 | 86 | |
83 | 87 | $form = new PageStabilityGeneralForm( $wgUser ); |
84 | | - $form->setPage( $title ); # Our target page |
| 88 | + $form->setPage( $this->title ); # Our target page |
85 | 89 | $form->setWatchThis( $params['watch'] ); # Watch this page |
86 | 90 | $form->setReason( $params['reason'] ); # Reason |
87 | 91 | $form->setReasonSelection( 'other' ); # Reason dropdown |
— | — | @@ -108,7 +112,7 @@ |
109 | 113 | |
110 | 114 | # Output success line with the title and config parameters |
111 | 115 | $res = array(); |
112 | | - $res['title'] = $title->getPrefixedText(); |
| 116 | + $res['title'] = $this->title->getPrefixedText(); |
113 | 117 | $res['default'] = $params['default']; |
114 | 118 | $res['autoreview'] = $params['autoreview']; |
115 | 119 | $res['expiry'] = $form->getExpiry(); |
— | — | @@ -192,7 +196,7 @@ |
193 | 197 | $params = $this->extractRequestParams(); |
194 | 198 | |
195 | 199 | $form = new PageStabilityProtectForm( $wgUser ); |
196 | | - $form->setPage( $title ); # Our target page |
| 200 | + $form->setPage( $this->title ); # Our target page |
197 | 201 | $form->setWatchThis( $params['watch'] ); # Watch this page |
198 | 202 | $form->setReason( $params['reason'] ); # Reason |
199 | 203 | $form->setReasonSelection( 'other' ); # Reason dropdown |
— | — | @@ -212,7 +216,7 @@ |
213 | 217 | |
214 | 218 | # Output success line with the title and config parameters |
215 | 219 | $res = array(); |
216 | | - $res['title'] = $title->getPrefixedText(); |
| 220 | + $res['title'] = $this->title->getPrefixedText(); |
217 | 221 | $res['protectlevel'] = $params['protectlevel']; |
218 | 222 | $res['expiry'] = $form->getExpiry(); |
219 | 223 | $this->getResult()->addValue( null, $this->getModuleName(), $res ); |