Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | /** |
149 | 149 | * Get the result data array |
150 | 150 | */ |
151 | | - public function getResultData() { |
| 151 | + public function & getResultData() { |
152 | 152 | return $this->getResult()->getData(); |
153 | 153 | } |
154 | 154 | |
— | — | @@ -156,23 +156,20 @@ |
157 | 157 | * notice any changes in API. |
158 | 158 | */ |
159 | 159 | 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(); |
161 | 162 | if(isset($data['warnings'][$this->getModuleName()])) |
162 | 163 | { |
163 | 164 | # Don't add duplicate warnings |
164 | 165 | $warn_regex = preg_quote($warning, '/'); |
165 | 166 | if(preg_match("/{$warn_regex}(\\n|$)/", $data['warnings'][$this->getModuleName()]['*'])) |
166 | 167 | 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()]); |
171 | 170 | } |
172 | 171 | $msg = array(); |
173 | 172 | ApiResult :: setContent($msg, $warning); |
174 | | - $this->getResult()->disableSizeCheck(); |
175 | 173 | $this->getResult()->addValue('warnings', $this->getModuleName(), $msg); |
176 | | - $this->getResult()->enableSizeCheck(); |
177 | 174 | } |
178 | 175 | |
179 | 176 | /** |