API: Add default setting for OpenSearch limit parameter

This is done as part of a GCI 2013 task.

Bug: 30089
Change-Id: I4c1a850520976a5b8b433feee4807c5f6960e3ac
This commit is contained in:
Alex Ivanov 2013-11-18 23:22:07 +02:00 committed by Bartosz Dziewoński
parent 43ad591c51
commit 3615dbda36
3 changed files with 11 additions and 1 deletions

View file

@ -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

View file

@ -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
*/

View file

@ -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,