From 99748cf05c73d8d7a5fefeaf2a9d718925289059 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 21 Oct 2009 18:44:58 +0000 Subject: [PATCH] Split allowing &suggest requests in API opensearch from $wgEnableMWSuggest to a separate variable. This makes it possible to enable SimpleSearch (which uses API opensearch) but disable mwsuggest; enabling both seems to cause issues with the login form in Safari or Opera (don't remember which) --- includes/DefaultSettings.php | 8 ++++++++ includes/api/ApiOpenSearch.php | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0bd958bbe3..94f41031f3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 * diff --git a/includes/api/ApiOpenSearch.php b/includes/api/ApiOpenSearch.php index f71dce5c60..27450d83e2 100644 --- a/includes/api/ApiOpenSearch.php +++ b/includes/api/ApiOpenSearch.php @@ -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', ); } -- 2.20.1