adjust mysql-usernamelength values for mariadb according to docs

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-11-24 10:03:40 +01:00
parent 4b7ae46fd7
commit 73fe533870

View File

@@ -541,10 +541,16 @@ class Database
*/ */
public static function getSqlUsernameLength() public static function getSqlUsernameLength()
{ {
// MySQL user names can be up to 32 characters long (16 characters before MySQL 5.7.8). // MariaDB supports up to 80 characters but only 64 for databases and as we use the loginname also for
$mysql_max = 32; // database names, we set the limit to 64 here
if (version_compare(Database::getAttribute(PDO::ATTR_SERVER_VERSION), '5.7.8', '<')) { if (strpos(strtolower(Database::getAttribute(\PDO::ATTR_SERVER_VERSION)), "mariadb") !== false) {
$mysql_max = 16; $mysql_max = 64;
} else {
// MySQL user names can be up to 32 characters long (16 characters before MySQL 5.7.8).
$mysql_max = 32;
if (version_compare(Database::getAttribute(\PDO::ATTR_SERVER_VERSION), '5.7.8', '<')) {
$mysql_max = 16;
}
} }
return $mysql_max; return $mysql_max;
} }