aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Setup/MySQL.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-01-29 15:54:39 +0100
committerRobin Appelman <robin@icewind.nl>2023-02-21 15:13:47 +0100
commitb923310580e7f488aa55ddda5c7bea788309e381 (patch)
tree7808e4a9396821c49f64b1f6b8fd8ca8abdf9d79 /lib/private/Setup/MySQL.php
parent95eeba83b6570b3cf7cbb79aea42222f7d3e03f4 (diff)
downloadnextcloud-server-b923310580e7f488aa55ddda5c7bea788309e381.tar.gz
nextcloud-server-b923310580e7f488aa55ddda5c7bea788309e381.zip
add option to disable db user creation trough environment variable
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Setup/MySQL.php')
-rw-r--r--lib/private/Setup/MySQL.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php
index caa73edccec..50f566728a9 100644
--- a/lib/private/Setup/MySQL.php
+++ b/lib/private/Setup/MySQL.php
@@ -49,7 +49,14 @@ class MySQL extends AbstractDatabase {
$connection = $this->connect(['dbname' => null]);
}
- $this->createSpecificUser($username, new ConnectionAdapter($connection));
+ if ($this->tryCreateDbUser) {
+ $this->createSpecificUser($username, new ConnectionAdapter($connection));
+ }
+
+ $this->config->setValues([
+ 'dbuser' => $this->dbUser,
+ 'dbpassword' => $this->dbPassword,
+ ]);
//create the database
$this->createDatabase($connection);
@@ -147,8 +154,7 @@ class MySQL extends AbstractDatabase {
. $this->random->generate(2, ISecureRandom::CHAR_UPPER)
. $this->random->generate(2, ISecureRandom::CHAR_LOWER)
. $this->random->generate(2, ISecureRandom::CHAR_DIGITS)
- . $this->random->generate(2, $saveSymbols)
- ;
+ . $this->random->generate(2, $saveSymbols);
$this->dbPassword = str_shuffle($password);
try {
@@ -196,10 +202,5 @@ class MySQL extends AbstractDatabase {
$this->dbUser = $rootUser;
$this->dbPassword = $rootPassword;
}
-
- $this->config->setValues([
- 'dbuser' => $this->dbUser,
- 'dbpassword' => $this->dbPassword,
- ]);
}
}