API: Add default setting for OpenSearch limit parameter
authorAlex Ivanov <alexivanov97@gmail.com>
Mon, 18 Nov 2013 21:22:07 +0000 (23:22 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 19 Nov 2013 18:55:04 +0000 (19:55 +0100)
This is done as part of a GCI 2013 task.

Bug: 30089
Change-Id: I4c1a850520976a5b8b433feee4807c5f6960e3ac

RELEASE-NOTES-1.23
includes/DefaultSettings.php
includes/api/ApiOpenSearch.php

index c5791ba..5c7edc8 100644 (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
index d428910..8faae60 100644 (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
  */
index 433b743..4b8578b 100644 (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,