r90487 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90486‎ | r90487 | r90488 >
Date:22:13, 20 June 2011
Author:reedy
Status:ok
Tags:
Comment:
Define a local variable for $result
Modified paths:
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -58,6 +58,8 @@
5959 $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
6060 }
6161
 62+ $result = $this->getResult();
 63+
6264 if ( $params['redirect'] ) {
6365 if ( $titleObj->isRedirect() ) {
6466 $oldTitle = $titleObj;
@@ -65,7 +67,7 @@
6668 $titles = Title::newFromRedirectArray( Revision::newFromTitle( $oldTitle )->getText( Revision::FOR_THIS_USER ) );
6769 // array_shift( $titles );
6870
69 - $this->getResult()->addValue( null, 'foo', $titles );
 71+ $result->addValue( null, 'foo', $titles );
7072
7173 $redirValues = array();
7274 foreach ( $titles as $id => $newTitle ) {
@@ -82,9 +84,8 @@
8385 $titleObj = $newTitle;
8486 }
8587
86 - $this->getResult()->setIndexedTagName( $redirValues, 'r' );
87 - $this->getResult()->addValue( null, 'redirects', $redirValues );
88 -
 88+ $result->setIndexedTagName( $redirValues, 'r' );
 89+ $result->addValue( null, 'redirects', $redirValues );
8990 }
9091 }
9192
@@ -256,7 +257,7 @@
257258 if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) ) {
258259 if ( count( $r ) ) {
259260 $r['result'] = 'Failure';
260 - $this->getResult()->addValue( null, $this->getModuleName(), $r );
 261+ $result->addValue( null, $this->getModuleName(), $r );
261262 return;
262263 } else {
263264 $this->dieUsageMsg( 'hookaborted' );
@@ -364,7 +365,7 @@
365366 default:
366367 $this->dieUsageMsg( array( 'unknownerror', $retval ) );
367368 }
368 - $this->getResult()->addValue( null, $this->getModuleName(), $r );
 369+ $result->addValue( null, $this->getModuleName(), $r );
369370 }
370371
371372 public function mustBePosted() {

Follow-up revisions

RevisionCommit summaryAuthorDate
r90488Followup r90487, kill $result=null in middlereedy22:16, 20 June 2011
r90489Revert r90488, rename variable from r90487reedy22:18, 20 June 2011

Status & tagging log