API: Fix r42813, committed some stuff that shouldn't be committed just yet
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 30 Oct 2008 17:24:40 +0000 (17:24 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 30 Oct 2008 17:24:40 +0000 (17:24 +0000)
includes/api/ApiBase.php

index f6c977a..e8ac8c1 100644 (file)
@@ -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();
        }
 
        /**