r42821 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42820‎ | r42821 | r42822 >
Date:17:24, 30 October 2008
Author:catrope
Status:old
Tags:
Comment:
API: Fix r42813, committed some stuff that shouldn't be committed just yet
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -147,7 +147,7 @@
148148 /**
149149 * Get the result data array
150150 */
151 - public function getResultData() {
 151+ public function & getResultData() {
152152 return $this->getResult()->getData();
153153 }
154154
@@ -156,23 +156,20 @@
157157 * notice any changes in API.
158158 */
159159 public function setWarning($warning) {
160 - $data = $this->getResult()->getData();
 160+ # If there is a warning already, append it to the existing one
 161+ $data =& $this->getResult()->getData();
161162 if(isset($data['warnings'][$this->getModuleName()]))
162163 {
163164 # Don't add duplicate warnings
164165 $warn_regex = preg_quote($warning, '/');
165166 if(preg_match("/{$warn_regex}(\\n|$)/", $data['warnings'][$this->getModuleName()]['*']))
166167 return;
167 - $oldwarning = $data['warnings'][$this->getModuleName()]['*'];
168 - # If there is a warning already, append it to the existing one
169 - $warning = "$oldwarning\n$warning";
170 - $this->getResult()->unsetValue('warnings', $this->getModuleName());
 168+ $warning = "{$data['warnings'][$this->getModuleName()]['*']}\n$warning";
 169+ unset($data['warnings'][$this->getModuleName()]);
171170 }
172171 $msg = array();
173172 ApiResult :: setContent($msg, $warning);
174 - $this->getResult()->disableSizeCheck();
175173 $this->getResult()->addValue('warnings', $this->getModuleName(), $msg);
176 - $this->getResult()->enableSizeCheck();
177174 }
178175
179176 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r42813API: Tweak r42794 (add docs for ApiBase class constants) a littlecatrope14:51, 30 October 2008

Status & tagging log