diff options
author | Simon Rettberg | 2022-06-01 09:39:22 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-06-01 09:39:22 +0200 |
commit | a869ec30b6e430d0600423c10deeebdabc822b73 (patch) | |
tree | ade2aaf60ad7cf2a3e9fad9259081fd3ae82fb63 | |
parent | Revert "[remoteaccess] Avoid waking too many machines" (diff) | |
download | slx-admin-a869ec30b6e430d0600423c10deeebdabc822b73.tar.gz slx-admin-a869ec30b6e430d0600423c10deeebdabc822b73.tar.xz slx-admin-a869ec30b6e430d0600423c10deeebdabc822b73.zip |
install.php: Quote table and column names
-rw-r--r-- | install.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/install.php b/install.php index 1737e7dc..29b734d1 100644 --- a/install.php +++ b/install.php @@ -373,12 +373,13 @@ if ($res['@@character_set_database'] !== 'utf8mb4' || $res['@@collation_database $args['comment'] = $c['COLUMN_COMMENT']; } $str .= ' COLLATE ' . $COLLATION; - if (Database::exec("ALTER TABLE {$c['TABLE_NAME']} MODIFY {$c['COLUMN_NAME']} $str", $args) === false) { + $query = "ALTER TABLE `{$c['TABLE_NAME']}` MODIFY `{$c['COLUMN_NAME']}` $str"; + if (Database::exec($query, $args) === false) { $charsetUpdate .= "\n+++ {$c['TABLE_NAME']}.{$c['COLUMN_NAME']} failed: " . Database::lastError(); - $charsetUpdate .= "\nALTER TABLE {$c['TABLE_NAME']} MODIFY {$c['COLUMN_NAME']} $str"; + $charsetUpdate .= "\n$query"; } } - if (empty($charsetUpdate) && Database::exec("ALTER DATABASE $db CHARACTER SET utf8mb4 COLLATE $COLLATION") === false) { + if (empty($charsetUpdate) && Database::exec("ALTER DATABASE `$db` CHARACTER SET utf8mb4 COLLATE $COLLATION") === false) { $charsetUpdate .= "\nCannot update database charset or collation: " . Database::lastError(); } } |