From: Alex Ivanov Date: Mon, 18 Nov 2013 21:22:07 +0000 (+0200) Subject: API: Add default setting for OpenSearch limit parameter X-Git-Tag: 1.31.0-rc.0~18033^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=3615dbda36112adb6efb65199aee0f8ad2c2510c;p=lhc%2Fweb%2Fwiklou.git API: Add default setting for OpenSearch limit parameter This is done as part of a GCI 2013 task. Bug: 30089 Change-Id: I4c1a850520976a5b8b433feee4807c5f6960e3ac --- diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index c5791ba0fd..5c7edc8b39 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -37,6 +37,8 @@ production. * (bug 56033) Add content model to the page information. * Added Article::MissingArticleConditions hook to give extensions a chance to hide their (unrelated) log entries. +* Added $wgOpenSearchDefaultLimit defining the default number of entries to show + on action=opensearch API call. === Bug fixes in 1.23 === * (bug 41759) The "updated since last visit" markers (on history pages, recent diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index d428910ad9..8faae6008c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5236,6 +5236,12 @@ $wgOpenSearchTemplate = false; */ $wgEnableOpenSearchSuggest = true; +/** + * Integer defining default number of entries to show on + * OpenSearch call. + */ +$wgOpenSearchDefaultLimit = 10; + /** * Expiry time for search suggestion responses */ diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index 433b743a72..4b8578bd59 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -90,10 +90,12 @@ class ApiOpenSearch extends ApiBase { } public function getAllowedParams() { + global $wgOpenSearchDefaultLimit; + return array( 'search' => null, 'limit' => array( - ApiBase::PARAM_DFLT => 10, + ApiBase::PARAM_DFLT => $wgOpenSearchDefaultLimit, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => 100,