From 853ce5e927043790cdedf3a4f0524d5559a90909 Mon Sep 17 00:00:00 2001 From: Fabian Stelzer Date: Mon, 22 Dec 2014 12:56:44 -0800 Subject: [PATCH] setup warning for mysql with default boolean syntax Summary: Ref: T6747 add a setup warning if mysql is configured with the default boolean syntax Test Plan: Run setup checks with default mysql config and then add the desired config option, restart and check again. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Maniphest Tasks: T6747 Differential Revision: https://secure.phabricator.com/D11030 --- .../check/PhabricatorSetupCheckMySQL.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/applications/config/check/PhabricatorSetupCheckMySQL.php b/src/applications/config/check/PhabricatorSetupCheckMySQL.php index 9ea3ca6f6d..16a5438cee 100644 --- a/src/applications/config/check/PhabricatorSetupCheckMySQL.php +++ b/src/applications/config/check/PhabricatorSetupCheckMySQL.php @@ -226,6 +226,41 @@ final class PhabricatorSetupCheckMySQL extends PhabricatorSetupCheck { } } + $bool_syntax = self::loadRawConfigValue('ft_boolean_syntax'); + if ($bool_syntax != ' |-><()~*:""&^') { + if (!PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) { + + $summary = pht( + 'MySQL is configured to search on fulltext indexes using "OR" by '. + 'default. Using "AND" is usually the desired behaviour.'); + + $message = pht( + "Your MySQL instance is configured to use the default Boolean ". + "search syntax when using fulltext indexes. This means searching ". + "for 'search words' will yield the query 'search OR words' ". + "instead of the desired 'search AND words'.\n\n". + "This might produce unexpected search results. \n\n". + "You can change this setting to a more sensible default. ". + "Alternatively, you can ignore this warning if ". + "using 'OR' is the desired behaviour. If you later plan ". + "to configure ElasticSearch, you can also ignore this warning: ". + "only MySQL fulltext search is affected.\n\n". + "To change this setting, add this to your %s file ". + "(in the %s section) and then restart %s:\n\n". + "%s\n", + phutil_tag('tt', array(), 'my.cnf'), + phutil_tag('tt', array(), '[mysqld]'), + phutil_tag('tt', array(), 'mysqld'), + phutil_tag('pre', array(), 'ft_boolean_syntax=\' |-><()~*:""&^\'')); + + $this->newIssue('mysql.ft_boolean_syntax') + ->setName(pht('MySQL is Using the Default Boolean Syntax')) + ->setSummary($summary) + ->setMessage($message) + ->addMySQLConfig('ft_boolean_syntax'); + } + } + $innodb_pool = self::loadRawConfigValue('innodb_buffer_pool_size'); $innodb_bytes = phutil_parse_bytes($innodb_pool); $innodb_readable = phutil_format_bytes($innodb_bytes);