diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-03 15:28:31 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-08 11:45:19 +0100 |
commit | 8b64e92b9262d2a2eec6345685ce421050f95c66 (patch) | |
tree | dd51490b8a184b2643414d11867a9fa450aa5065 /lib/private/Setup/MySQL.php | |
parent | 84e6e9f7cf19207041925eaa237d24e1c12c2c2d (diff) | |
download | nextcloud-server-8b64e92b9262d2a2eec6345685ce421050f95c66.tar.gz nextcloud-server-8b64e92b9262d2a2eec6345685ce421050f95c66.zip |
Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Setup/MySQL.php')
-rw-r--r-- | lib/private/Setup/MySQL.php | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 966c97edf55..21339dc46d0 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -31,6 +31,7 @@ namespace OC\Setup; +use OC\DB\ConnectionAdapter; use OC\DB\MySqlTools; use OCP\IDBConnection; use OCP\ILogger; @@ -45,12 +46,12 @@ class MySQL extends AbstractDatabase { // detect mb4 $tools = new MySqlTools(); - if ($tools->supports4ByteCharset($connection)) { + if ($tools->supports4ByteCharset(new ConnectionAdapter($connection))) { $this->config->setValue('mysql.utf8mb4', true); $connection = $this->connect(['dbname' => null]); } - $this->createSpecificUser($username, $connection); + $this->createSpecificUser($username, new ConnectionAdapter($connection)); //create the database $this->createDatabase($connection); @@ -156,27 +157,24 @@ class MySQL extends AbstractDatabase { $result = $connection->executeQuery($query, [$adminUser]); //current dbuser has admin rights - if ($result) { - $data = $result->fetchAll(); - //new dbuser does not exist - if (count($data) === 0) { - //use the admin login data for the new database user - $this->dbUser = $adminUser; - - //create a random password so we don't need to store the admin password in the config file - $this->dbPassword = $this->random->generate(30); - - $this->createDBUser($connection); - - break; - } else { - //repeat with different username - $length = strlen((string)$i); - $adminUser = substr('oc_' . $username, 0, 16 - $length) . $i; - $i++; - } - } else { + $data = $result->fetchAll(); + $result->closeCursor(); + //new dbuser does not exist + if (count($data) === 0) { + //use the admin login data for the new database user + $this->dbUser = $adminUser; + + //create a random password so we don't need to store the admin password in the config file + $this->dbPassword = $this->random->generate(30); + + $this->createDBUser($connection); + break; + } else { + //repeat with different username + $length = strlen((string)$i); + $adminUser = substr('oc_' . $username, 0, 16 - $length) . $i; + $i++; } } } |