1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-16 11:44:42 +02:00

Update SessionHandlerDB to support utf8mb4 charset for its table when $config->dbCharset specifies it.

This commit is contained in:
Ryan Cramer
2019-12-31 14:05:15 -05:00
parent e7c9a1b79f
commit a0ddedc005

View File

@@ -182,6 +182,7 @@ class SessionHandlerDB extends WireSessionHandler implements Module, Configurabl
public function ___install() { public function ___install() {
$table = self::dbTableName; $table = self::dbTableName;
$charset = $this->wire('config')->dbCharset;
$sql = "CREATE TABLE `$table` (" . $sql = "CREATE TABLE `$table` (" .
"id CHAR(32) NOT NULL, " . "id CHAR(32) NOT NULL, " .
@@ -195,7 +196,7 @@ class SessionHandlerDB extends WireSessionHandler implements Module, Configurabl
"INDEX (pages_id), " . "INDEX (pages_id), " .
"INDEX (user_id), " . "INDEX (user_id), " .
"INDEX (ts) " . "INDEX (ts) " .
") ENGINE=InnoDB DEFAULT CHARSET=utf8"; ") ENGINE=InnoDB DEFAULT CHARSET=$charset";
$this->database->query($sql); $this->database->query($sql);
} }