From 13ce475d48f846c56b4bf52ae5fc6c1216dc8deb Mon Sep 17 00:00:00 2001
From: Andreas Gohr <gohr@cosmocode.de>
Date: Wed, 11 Apr 2018 14:39:04 +0200
Subject: [PATCH] shortened new search configs

shorter names are more in line with what we already use, makes less
layout problems in the documentation and is easier to type when telling
people about it.
---
 conf/dokuwiki.php                               |  4 ++--
 inc/Action/Search.php                           | 12 ++++++------
 lib/plugins/config/lang/en/lang.php             | 12 ++++++------
 lib/plugins/config/settings/config.metadata.php |  4 ++--
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php
index 97f396ed6..d57cf1c57 100644
--- a/conf/dokuwiki.php
+++ b/conf/dokuwiki.php
@@ -156,8 +156,8 @@ $conf['broken_iua']  = 0;                //Platform with broken ignore_user_abor
 $conf['xsendfile']   = 0;                //Use X-Sendfile (1 = lighttpd, 2 = standard)
 $conf['renderer_xhtml'] = 'xhtml';       //renderer to use for main page generation
 $conf['readdircache'] = 0;               //time cache in second for the readdir operation, 0 to deactivate.
-$conf['search_limit_to_first_ns'] = 0;   //Option to limit the search to the current X namespaces
-$conf['search_default_fragment_behaviour'] = 'exact'; // Option to specify the default fragment search behavior
+$conf['search_nslimit'] = 0;             //limit the search to the current X namespaces
+$conf['search_fragment'] = 'exact';      //specify the default fragment search behavior
 
 /* Network Settings */
 $conf['dnslookups'] = 1;                 //disable to disallow IP to hostname lookups
diff --git a/inc/Action/Search.php b/inc/Action/Search.php
index c182ca3e9..aa19671da 100644
--- a/inc/Action/Search.php
+++ b/inc/Action/Search.php
@@ -72,7 +72,7 @@ class Search extends AbstractAction {
     }
 
     /**
-     * Adjust the global query accordingly to the config search_limit_to_first_ns and search_default_fragment_behaviour
+     * Adjust the global query accordingly to the config search_nslimit and search_fragment
      *
      * This will only do something if the search didn't originate from the form on the searchpage itself
      */
@@ -88,16 +88,16 @@ class Search extends AbstractAction {
         $parsedQuery = ft_queryParser($Indexer, $QUERY);
 
         if (empty($parsedQuery['ns']) && empty($parsedQuery['notns'])) {
-            if ($conf['search_limit_to_first_ns'] > 0) {
+            if ($conf['search_nslimit'] > 0) {
                 if (getNS($ID) !== false) {
                     $nsParts = explode(':', getNS($ID));
-                    $ns = implode(':', array_slice($nsParts, 0, $conf['search_limit_to_first_ns']));
+                    $ns = implode(':', array_slice($nsParts, 0, $conf['search_nslimit']));
                     $QUERY .= " @$ns";
                 }
             }
         }
 
-        if ($conf['search_default_fragment_behaviour'] !== 'exact') {
+        if ($conf['search_fragment'] !== 'exact') {
             if (empty(array_diff($parsedQuery['words'], $parsedQuery['and']))) {
                 if (strpos($QUERY, '*') === false) {
                     $queryParts = explode(' ', $QUERY);
@@ -117,10 +117,10 @@ class Search extends AbstractAction {
 
                         global $conf;
 
-                        if ($conf['search_default_fragment_behaviour'] === 'starts_with') {
+                        if ($conf['search_fragment'] === 'starts_with') {
                             return $part . '*';
                         }
-                        if ($conf['search_default_fragment_behaviour'] === 'ends_with') {
+                        if ($conf['search_fragment'] === 'ends_with') {
                             return '*' . $part;
                         }
 
diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php
index cee84604c..356db4e5e 100644
--- a/lib/plugins/config/lang/en/lang.php
+++ b/lib/plugins/config/lang/en/lang.php
@@ -178,12 +178,12 @@ $lang['xsendfile']   = 'Use the X-Sendfile header to let the webserver deliver s
 $lang['renderer_xhtml']   = 'Renderer to use for main (xhtml) wiki output';
 $lang['renderer__core']   = '%s (dokuwiki core)';
 $lang['renderer__plugin'] = '%s (plugin)';
-$lang['search_limit_to_first_ns'] = 'Limit the search to the current X namespaces. When a search is executed from a page within a deeper namespace, the first X namespaces will be added as filter';
-$lang['search_default_fragment_behaviour'] = 'Specify the default fragment search behavior';
-$lang['search_default_fragment_behaviour_o_exact'] = 'exact';
-$lang['search_default_fragment_behaviour_o_starts_with'] = 'starts with';
-$lang['search_default_fragment_behaviour_o_ends_with'] = 'ends with';
-$lang['search_default_fragment_behaviour_o_contains'] = 'contains';
+$lang['search_nslimit'] = 'Limit the search to the current X namespaces. When a search is executed from a page within a deeper namespace, the first X namespaces will be added as filter';
+$lang['search_fragment'] = 'Specify the default fragment search behavior';
+$lang['search_fragment_o_exact'] = 'exact';
+$lang['search_fragment_o_starts_with'] = 'starts with';
+$lang['search_fragment_o_ends_with'] = 'ends with';
+$lang['search_fragment_o_contains'] = 'contains';
 
 /* Network Options */
 $lang['dnslookups'] = 'DokuWiki will lookup hostnames for remote IP addresses of users editing pages. If you have a slow or non working DNS server or don\'t want this feature, disable this option';
diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php
index 750245957..acdf93ba7 100644
--- a/lib/plugins/config/settings/config.metadata.php
+++ b/lib/plugins/config/settings/config.metadata.php
@@ -219,8 +219,8 @@ $meta['broken_iua']  = array('onoff');
 $meta['xsendfile']   = array('multichoice','_choices' => array(0,1,2,3),'_caution' => 'warning');
 $meta['renderer_xhtml'] = array('renderer','_format' => 'xhtml','_choices' => array('xhtml'),'_caution' => 'warning');
 $meta['readdircache'] = array('numeric');
-$meta['search_limit_to_first_ns'] = array('numeric', '_min' => 0);
-$meta['search_default_fragment_behaviour'] = array('multichoice','_choices' => array('exact', 'starts_with', 'ends_with', 'contains'),);
+$meta['search_nslimit'] = array('numeric', '_min' => 0);
+$meta['search_fragment'] = array('multichoice','_choices' => array('exact', 'starts_with', 'ends_with', 'contains'),);
 
 $meta['_network']    = array('fieldset');
 $meta['dnslookups']  = array('onoff');
-- 
GitLab