API: Crusade against extract(). Left one extract() call alone in ApiQueryBacklinks...
[lhc/web/wiklou.git] / includes / api / ApiBase.php
index f6c977a..ff9129c 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();
        }
 
        /**
@@ -372,7 +369,6 @@ abstract class ApiBase {
        /**
        * Using getAllowedParams(), makes an array of the values provided by the user,
        * with key being the name of the variable, and value - validated value from user or default.
-       * This method can be used to generate local variables using extract().
        * limit=max will not be parsed if $parseMaxLimit is set to false; use this
        * when the max limit is not definite, e.g. when getting revisions.
        */