r75269 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75268‎ | r75269 | r75270 >
Date:16:49, 23 October 2010
Author:demon
Status:ok
Tags:
Comment:
(bug 25625): Fix undefined $title objects
Modified paths:
  • /trunk/extensions/FlaggedRevs/api/ApiStabilize.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/api/ApiStabilize.php
@@ -27,6 +27,10 @@
2828 * @ingroup FlaggedRevs
2929 */
3030 abstract class ApiStabilize extends ApiBase {
 31+
 32+ // Title param
 33+ protected $title;
 34+
3135 public function execute() {
3236 global $wgUser;
3337 $params = $this->extractRequestParams();
@@ -37,11 +41,11 @@
3842 $this->dieUsageMsg( array( 'missingparam', 'token' ) );
3943 }
4044
41 - $title = Title::newFromText( $params['title'] );
42 - if ( $title == null ) {
 45+ $this->title = Title::newFromText( $params['title'] );
 46+ if ( $this->title == null ) {
4347 $this->dieUsage( "Invalid title given.", "invalidtitle" );
4448 }
45 - $errors = $title->getUserPermissionsErrors( 'stablesettings', $wgUser );
 49+ $errors = $this->title->getUserPermissionsErrors( 'stablesettings', $wgUser );
4650 if ( $errors ) {
4751 // We don't care about multiple errors, just report one of them
4852 $this->dieUsageMsg( reset( $errors ) );
@@ -80,7 +84,7 @@
8185 $params = $this->extractRequestParams();
8286
8387 $form = new PageStabilityGeneralForm( $wgUser );
84 - $form->setPage( $title ); # Our target page
 88+ $form->setPage( $this->title ); # Our target page
8589 $form->setWatchThis( $params['watch'] ); # Watch this page
8690 $form->setReason( $params['reason'] ); # Reason
8791 $form->setReasonSelection( 'other' ); # Reason dropdown
@@ -108,7 +112,7 @@
109113
110114 # Output success line with the title and config parameters
111115 $res = array();
112 - $res['title'] = $title->getPrefixedText();
 116+ $res['title'] = $this->title->getPrefixedText();
113117 $res['default'] = $params['default'];
114118 $res['autoreview'] = $params['autoreview'];
115119 $res['expiry'] = $form->getExpiry();
@@ -192,7 +196,7 @@
193197 $params = $this->extractRequestParams();
194198
195199 $form = new PageStabilityProtectForm( $wgUser );
196 - $form->setPage( $title ); # Our target page
 200+ $form->setPage( $this->title ); # Our target page
197201 $form->setWatchThis( $params['watch'] ); # Watch this page
198202 $form->setReason( $params['reason'] ); # Reason
199203 $form->setReasonSelection( 'other' ); # Reason dropdown
@@ -212,7 +216,7 @@
213217
214218 # Output success line with the title and config parameters
215219 $res = array();
216 - $res['title'] = $title->getPrefixedText();
 220+ $res['title'] = $this->title->getPrefixedText();
217221 $res['protectlevel'] = $params['protectlevel'];
218222 $res['expiry'] = $form->getExpiry();
219223 $this->getResult()->addValue( null, $this->getModuleName(), $res );

Status & tagging log