API:
authorRoan Kattouw <catrope@users.mediawiki.org>
Tue, 5 Aug 2008 16:32:28 +0000 (16:32 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Tue, 5 Aug 2008 16:32:28 +0000 (16:32 +0000)
* (bug 15048) Added limit field for multivalue parameters to action=paraminfo output.
* When the limit on multivalue parameters is exceeded, a warning is issued

RELEASE-NOTES
includes/api/ApiBase.php
includes/api/ApiMain.php
includes/api/ApiParamInfo.php

index e9a5ee3..f76cdef 100644 (file)
@@ -71,6 +71,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   are now listed on action=help
 * (bug 15044) Added requestid parameter to api.php to facilitate distinguishing
   between requests
+* (bug 15048) Added limit field for multivalue parameters to action=paraminfo
+  output.
+* When the limit on multivalue parameters is exceeded, a warning is issued 
 
 === Languages updated in 1.14 ===
 
index 4409bea..9f66869 100644 (file)
@@ -515,10 +515,12 @@ abstract class ApiBase {
        protected function parseMultiValue($valueName, $value, $allowMultiple, $allowedValues) {
                if( trim($value) === "" )
                        return array();
-               $sizeLimit = $this->mMainModule->canApiHighLimits() ? 501 : 51;
-               $valuesList = explode('|', $value,$sizeLimit);
-               if( count($valuesList) == $sizeLimit ) {
+               $sizeLimit = $this->mMainModule->canApiHighLimits() ? self::LIMIT_SML2 : self::LIMIT_SML1;
+               $valuesList = explode('|', $value, $sizeLimit + 1);
+               if( count($valuesList) == $sizeLimit + 1 ) {
                        $junk = array_pop($valuesList); // kill last jumbled param
+                       // Set a warning too
+                       $this->setWarning("Too many values supplied for parameter '$valueName': the limit is $sizeLimit");
                }
                if (!$allowMultiple && count($valuesList) != 1) {
                        $possibleValues = is_array($allowedValues) ? "of '" . implode("', '", $allowedValues) . "'" : '';
index 2e9da65..22f14a3 100644 (file)
@@ -111,7 +111,7 @@ class ApiMain extends ApiBase {
                                                'params' => array()
                                        ),
                                        'apihighlimits' => array(
-                                               'msg' => 'Use higher limits in API queries (Slow queries: $1 results; Fast queries: $2 results). These limits also apply to multivalue parameters.',
+                                               'msg' => 'Use higher limits in API queries (Slow queries: $1 results; Fast queries: $2 results). The limits for slow queries also apply to multivalue parameters.',
                                                'params' => array (ApiMain::LIMIT_SML2, ApiMain::LIMIT_BIG2)
                                        )
        );
index d823eef..91e526e 100644 (file)
@@ -111,7 +111,12 @@ class ApiParamInfo extends ApiBase {
                                $a['default'] = $p[ApiBase::PARAM_DFLT];
                        if(isset($p[ApiBase::PARAM_ISMULTI]))
                                if($p[ApiBase::PARAM_ISMULTI])
+                               {
                                        $a['multi'] = '';
+                                       $a['limit'] = $this->getMain()->canApiHighLimits() ?
+                                                       ApiBase::LIMIT_SML2 :
+                                                       ApiBase::LIMIT_SML1;
+                               }
                        if(isset($p[ApiBase::PARAM_TYPE]))
                        {
                                $a['type'] = $p[ApiBase::PARAM_TYPE];