Skip to content

Commit 122ac8f

Browse files
committed
setup: Warn users about wildcards in their database name
1 parent 451ec34 commit 122ac8f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

modules/setup/application/forms/DatabaseCreationPage.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ public function setDatabaseUsagePrivileges(array $privileges)
9191
*/
9292
public function createElements(array $formData)
9393
{
94+
if ($this->config['db'] === 'mysql' && preg_match('/[_%]/', $this->config['dbname'])) {
95+
$this->warning(sprintf(
96+
$this->translate(
97+
'The database name may contain either an underscore or a percent sign.'
98+
. ' In MySQL these characters represent a wildcard. If part of a database name,'
99+
. ' they might not have been escaped when manually granting privileges.'
100+
. ' Privileges might not be detected in this case. Check the documentation and'
101+
. ' update your grants accordingly: %s'
102+
),
103+
'https://dev.mysql.com/doc/refman/8.0/en/grant.html#grant-quoting'
104+
));
105+
}
106+
94107
$skipValidation = isset($formData['skip_validation']) && $formData['skip_validation'];
95108
$this->addElement(
96109
'text',

0 commit comments

Comments
 (0)