aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Setup/AbstractDatabase.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-12-28 11:45:58 +0100
committerJulius Härtl <jus@bitgrid.net>2023-12-28 11:51:35 +0100
commit81b089cf30a3455a12c1f7edd195e4f16b0460c4 (patch)
treee65f81b56c3a21d585da7f60a607c8ef00421069 /lib/private/Setup/AbstractDatabase.php
parent2362a967d6bb655f43e5350929b8ea0ded4beabb (diff)
downloadnextcloud-server-81b089cf30a3455a12c1f7edd195e4f16b0460c4.tar.gz
nextcloud-server-81b089cf30a3455a12c1f7edd195e4f16b0460c4.zip
fix: Avoid using replicas during setup
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Setup/AbstractDatabase.php')
-rw-r--r--lib/private/Setup/AbstractDatabase.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php
index 88a31eaccdc..82c00cb271a 100644
--- a/lib/private/Setup/AbstractDatabase.php
+++ b/lib/private/Setup/AbstractDatabase.php
@@ -140,10 +140,12 @@ abstract class AbstractDatabase {
}
$connectionParams['host'] = $host;
}
-
- $connectionParams = array_merge($connectionParams, ['primary' => $connectionParams, 'replica' => [$connectionParams]], $configOverwrite);
+ $connectionParams = array_merge($connectionParams, $configOverwrite);
+ $connectionParams = array_merge($connectionParams, ['primary' => $connectionParams, 'replica' => [$connectionParams]]);
$cf = new ConnectionFactory($this->config);
- return $cf->getConnection($this->config->getValue('dbtype', 'sqlite'), $connectionParams);
+ $connection = $cf->getConnection($this->config->getValue('dbtype', 'sqlite'), $connectionParams);
+ $connection->ensureConnectedToPrimary();
+ return $connection;
}
/**