Split allowing &suggest requests in API opensearch from $wgEnableMWSuggest to a separ...
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 21 Oct 2009 18:44:58 +0000 (18:44 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 21 Oct 2009 18:44:58 +0000 (18:44 +0000)
includes/DefaultSettings.php
includes/api/ApiOpenSearch.php

index 0bd958b..94f4103 100644 (file)
@@ -1976,9 +1976,17 @@ $wgOpenSearchTemplate = false;
 /**
  * Enable suggestions while typing in search boxes
  * (results are passed around in OpenSearch format)
+ * Requires $wgEnableOpenSearchSuggest = true;
  */
 $wgEnableMWSuggest = false;
 
+/**
+ * Enable OpenSearch suggestions requested by MediaWiki. Set this to
+ * false if you've disabled MWSuggest or another suggestion script and
+ * want reduce load caused by cached scripts pulling suggestions.
+ */
+$wgEnableOpenSearchSuggest = true;
+
 /**
  *  Template for internal MediaWiki suggestion engine, defaults to API action=opensearch
  *
index f71dce5..27450d8 100644 (file)
@@ -49,9 +49,8 @@ class ApiOpenSearch extends ApiBase {
                $namespaces = $params['namespace'];
                $suggest = $params['suggest'];
 
-               // $wgEnableMWSuggest hit incoming when $wgEnableMWSuggest is 
-               // disabled
-               if( $suggest && !$wgEnableMWSuggest )
+               // MWSuggest or similar hit
+               if( $suggest && !$wgEnableOpenSearchSuggest )
                        $srchres = array();
                else {
                        // Open search results may be stored for a very long
@@ -91,7 +90,7 @@ class ApiOpenSearch extends ApiBase {
                        'search' => 'Search string',
                        'limit' => 'Maximum amount of results to return',
                        'namespace' => 'Namespaces to search',
-                       'suggest' => 'Do nothing if $wgEnableMWSuggest is false',
+                       'suggest' => 'Do nothing if $wgEnableOpenSearchSuggest is false',
                );
        }