From ec6060e5c9b8ff69d243d0440d9298276c346e59 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 30 Oct 2008 17:24:40 +0000 Subject: [PATCH] API: Fix r42813, committed some stuff that shouldn't be committed just yet --- includes/api/ApiBase.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index f6c977a69d..e8ac8c114a 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -147,7 +147,7 @@ abstract class ApiBase { /** * Get the result data array */ - public function getResultData() { + public function & getResultData() { return $this->getResult()->getData(); } @@ -156,23 +156,20 @@ abstract class ApiBase { * notice any changes in API. */ public function setWarning($warning) { - $data = $this->getResult()->getData(); + # If there is a warning already, append it to the existing one + $data =& $this->getResult()->getData(); if(isset($data['warnings'][$this->getModuleName()])) { # Don't add duplicate warnings $warn_regex = preg_quote($warning, '/'); if(preg_match("/{$warn_regex}(\\n|$)/", $data['warnings'][$this->getModuleName()]['*'])) return; - $oldwarning = $data['warnings'][$this->getModuleName()]['*']; - # If there is a warning already, append it to the existing one - $warning = "$oldwarning\n$warning"; - $this->getResult()->unsetValue('warnings', $this->getModuleName()); + $warning = "{$data['warnings'][$this->getModuleName()]['*']}\n$warning"; + unset($data['warnings'][$this->getModuleName()]); } $msg = array(); ApiResult :: setContent($msg, $warning); - $this->getResult()->disableSizeCheck(); $this->getResult()->addValue('warnings', $this->getModuleName(), $msg); - $this->getResult()->enableSizeCheck(); } /** -- 2.20.1