Skip to content

Commit 3275d80

Browse files
author
epriestley
committed
Detect ft_stopword_file being unsupported
Summary: Ref T2605. For old MySQL, this option is not supported. Catch that and tailor the error. I couldn't find the first version of MySQL which introduced this optino in order to produce a more useful error. I spent about ~10 minutes looking. Test Plan: Faked the error, survived setup. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T2605 Differential Revision: https://secure.phabricator.com/D10342
1 parent d17a25e commit 3275d80

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/applications/config/check/PhabricatorSetupCheckMySQL.php

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,35 @@ protected function executeChecks() {
6060
->setMessage($message);
6161
}
6262

63-
$stopword_file = queryfx_one($conn_raw, 'SELECT @@ft_stopword_file');
64-
$stopword_file = $stopword_file['@@ft_stopword_file'];
65-
if ($stopword_file == '(built-in)') {
66-
if (!PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) {
63+
try {
64+
$stopword_file = queryfx_one($conn_raw, 'SELECT @@ft_stopword_file');
65+
$stopword_file = $stopword_file['@@ft_stopword_file'];
66+
} catch (AphrontQueryException $ex) {
67+
$stopword_file = null;
68+
}
69+
70+
if (!PhabricatorDefaultSearchEngineSelector::shouldUseElasticSearch()) {
71+
if ($stopword_file === null) {
72+
$summary = pht(
73+
'Your version of MySQL does not support configuration of a '.
74+
'stopword file. You will not be able to find search results for '.
75+
'common words.');
76+
77+
$message = pht(
78+
"Your MySQL instance does not support the %s option. You will not ".
79+
"be able to find search results for common words. You can gain ".
80+
"access to this option by upgrading MySQL to a more recent ".
81+
"version.\n\n".
82+
"You can ignore this warning if you plan to configure ElasticSearch ".
83+
"later, or aren't concerned about searching for common words.",
84+
phutil_tag('tt', array(), 'ft_stopword_file'));
85+
86+
$this->newIssue('mysql.ft_stopword_file')
87+
->setName(pht('MySQL ft_stopword_file Not Supported'))
88+
->setSummary($summary)
89+
->setMessage($message);
6790

91+
} else if ($stopword_file == '(built-in)') {
6892
$root = dirname(phutil_get_library_root('phabricator'));
6993
$stopword_path = $root.'/resources/sql/stopwords.txt';
7094
$stopword_path = Filesystem::resolvePath($stopword_path);

0 commit comments

Comments
 (0)