http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70063

Revision: 70063
Author:   tstarling
Date:     2010-07-28 04:19:33 +0000 (Wed, 28 Jul 2010)

Log Message:
-----------
MFT r70062: fix fatal error when limit=max

Modified Paths:
--------------
    branches/wmf/1.16wmf4/includes/api/ApiBase.php

Property Changed:
----------------
    branches/wmf/1.16wmf4/includes/api/ApiBase.php

Modified: branches/wmf/1.16wmf4/includes/api/ApiBase.php
===================================================================
--- branches/wmf/1.16wmf4/includes/api/ApiBase.php      2010-07-28 04:12:36 UTC 
(rev 70062)
+++ branches/wmf/1.16wmf4/includes/api/ApiBase.php      2010-07-28 04:19:33 UTC 
(rev 70063)
@@ -57,6 +57,7 @@
        const LIMIT_SML2 = 500; // Slow query, bot/sysop limit
 
        private $mMainModule, $mModuleName, $mModulePrefix;
+       private $mParamCache = array();
 
        /**
         * Constructor
@@ -472,16 +473,20 @@
         * @return array
         */
        public function extractRequestParams( $parseLimit = true ) {
-               $params = $this->getFinalParams();
-               $results = array();
+               // Cache parameters, for performance and to avoid bug 24564.
+               if ( !isset( $this->mParamCache[$parseLimit] ) ) {
+                       $params = $this->getFinalParams();
+                       $results = array();
 
-               if($params) {                   /* getFinalParams() can return 
false */
-                       foreach ( $params as $paramName => $paramSettings ) {
-                               $results[$paramName] = 
$this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
+                       if($params) {                   /* getFinalParams() can 
return false */
+                               foreach ( $params as $paramName => 
$paramSettings ) {
+                                       $results[$paramName] = 
$this->getParameterFromSettings( 
+                                               $paramName, $paramSettings, 
$parseLimit );
+                               }
                        }
+                       $this->mParamCache[$parseLimit] = $results;
                }
-
-               return $results;
+               return $this->mParamCache[$parseLimit];
        }
 
        /**


Property changes on: branches/wmf/1.16wmf4/includes/api/ApiBase.php
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/REL1_15/phase3/includes/api/ApiBase.php:51646
/branches/sqlite/includes/api/ApiBase.php:58211-58321
/branches/wmf-deployment/includes/api/ApiBase.php:53381,59952,60970
/trunk/phase3/includes/api/ApiBase.php:63549,63764,63897-63901,64454,66486,70062



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to