aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-08-12 09:43:38 +0200
committerJoas Schilling <coding@schilljs.com>2022-08-12 09:43:38 +0200
commitd275c930356fd4203c0cf9e2850c8e92f3d0c2b9 (patch)
tree1eafde882a4473bfbc3e8086269105e73c141793
parent7391c8149540d16fb9ecc12568e7b8ebfcdec35c (diff)
downloadnextcloud-server-d275c930356fd4203c0cf9e2850c8e92f3d0c2b9.tar.gz
nextcloud-server-d275c930356fd4203c0cf9e2850c8e92f3d0c2b9.zip
Recover installation when creating the user failed
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/private/Setup/MySQL.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php
index e878ed4d9aa..7788e3e006c 100644
--- a/lib/private/Setup/MySQL.php
+++ b/lib/private/Setup/MySQL.php
@@ -129,6 +129,7 @@ class MySQL extends AbstractDatabase {
'exception' => $ex,
'app' => 'mysql.setup',
]);
+ throw $ex;
}
}
@@ -137,6 +138,9 @@ class MySQL extends AbstractDatabase {
* @param IDBConnection $connection
*/
private function createSpecificUser($username, $connection): void {
+ $rootUser = $this->dbUser;
+ $rootPassword = $this->dbPassword;
+
try {
//user already specified in config
$oldUser = $this->config->getValue('dbuser', false);
@@ -179,6 +183,9 @@ class MySQL extends AbstractDatabase {
'exception' => $ex,
'app' => 'mysql.setup',
]);
+ // Restore the original credentials
+ $this->dbUser = $rootUser;
+ $this->dbPassword = $rootPassword;
}
$this->config->setValues([