From: Sam Reed Date: Mon, 20 Jun 2011 22:13:45 +0000 (+0000) Subject: Define a local variable for $result X-Git-Tag: 1.31.0-rc.0~29390 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=446d10c8d2f5a2f8bfd1fa988b294c5b316ec9a1;p=lhc%2Fweb%2Fwiklou.git Define a local variable for $result --- diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 0e5225200b..9be14f1c4c 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -58,6 +58,8 @@ class ApiEditPage extends ApiBase { $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); } + $result = $this->getResult(); + if ( $params['redirect'] ) { if ( $titleObj->isRedirect() ) { $oldTitle = $titleObj; @@ -65,7 +67,7 @@ class ApiEditPage extends ApiBase { $titles = Title::newFromRedirectArray( Revision::newFromTitle( $oldTitle )->getText( Revision::FOR_THIS_USER ) ); // array_shift( $titles ); - $this->getResult()->addValue( null, 'foo', $titles ); + $result->addValue( null, 'foo', $titles ); $redirValues = array(); foreach ( $titles as $id => $newTitle ) { @@ -82,9 +84,8 @@ class ApiEditPage extends ApiBase { $titleObj = $newTitle; } - $this->getResult()->setIndexedTagName( $redirValues, 'r' ); - $this->getResult()->addValue( null, 'redirects', $redirValues ); - + $result->setIndexedTagName( $redirValues, 'r' ); + $result->addValue( null, 'redirects', $redirValues ); } } @@ -256,7 +257,7 @@ class ApiEditPage extends ApiBase { if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) ) { if ( count( $r ) ) { $r['result'] = 'Failure'; - $this->getResult()->addValue( null, $this->getModuleName(), $r ); + $result->addValue( null, $this->getModuleName(), $r ); return; } else { $this->dieUsageMsg( 'hookaborted' ); @@ -364,7 +365,7 @@ class ApiEditPage extends ApiBase { default: $this->dieUsageMsg( array( 'unknownerror', $retval ) ); } - $this->getResult()->addValue( null, $this->getModuleName(), $r ); + $result->addValue( null, $this->getModuleName(), $r ); } public function mustBePosted() {