From f758d0d9434be822f9f504069069d2a538d72e8d Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Mon, 7 Mar 2022 18:43:06 +0100 Subject: [PATCH] fix installation for mariadb-10.5; minor fixes for global search later Signed-off-by: Michael Kaufmann --- install/lib/class.FroxlorInstall.php | 20 +++++++++++++++++++- lib/Froxlor/UI/Callbacks/Text.php | 1 - lib/Froxlor/UI/Collection.php | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/install/lib/class.FroxlorInstall.php b/install/lib/class.FroxlorInstall.php index dfd186cc..148420e5 100644 --- a/install/lib/class.FroxlorInstall.php +++ b/install/lib/class.FroxlorInstall.php @@ -812,8 +812,26 @@ class FroxlorInstall private function _grantDbPrivilegesTo(&$db_root, $database, $username, $password, $access_host) { + // mariadb + if (version_compare($db_root->getAttribute(\PDO::ATTR_SERVER_VERSION), '10.0.0', '>=')) { + // create user + $stmt = $db_root->prepare(" + CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED BY :password + "); + $stmt->execute(array( + "password" => $password + )); + // grant privileges + $stmt = $db_root->prepare(" + GRANT ALL ON `" . $database . "`.* TO :username@:host + "); + $stmt->execute(array( + "username" => $username, + "host" => $access_host + )); + } // mysql8 compatibility - if (version_compare($db_root->getAttribute(\PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) { + elseif (version_compare($db_root->getAttribute(\PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) { // create user $stmt = $db_root->prepare(" CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED WITH mysql_native_password BY :password diff --git a/lib/Froxlor/UI/Callbacks/Text.php b/lib/Froxlor/UI/Callbacks/Text.php index c5518d46..634da10a 100644 --- a/lib/Froxlor/UI/Callbacks/Text.php +++ b/lib/Froxlor/UI/Callbacks/Text.php @@ -3,7 +3,6 @@ namespace Froxlor\UI\Callbacks; use Froxlor\PhpHelper; -use Froxlor\Settings; use Froxlor\UI\Panel\UI; use Froxlor\User; diff --git a/lib/Froxlor/UI/Collection.php b/lib/Froxlor/UI/Collection.php index 96c6d911..8d5073ff 100644 --- a/lib/Froxlor/UI/Collection.php +++ b/lib/Froxlor/UI/Collection.php @@ -25,7 +25,7 @@ class Collection private array $has = []; private array $params; private array $userinfo; - private ?Pagination $pagination; + private ?Pagination $pagination = null; public function __construct(string $class, array $userInfo, array $params = []) {