aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKate <26026535+provokateurin@users.noreply.github.com>2025-01-31 08:51:10 +0100
committerGitHub <noreply@github.com>2025-01-31 08:51:10 +0100
commit2053455b5655fa4bdcec5eef4fd0216e8a69baab (patch)
treee08d4101eada3e579e115138dee12299f31db801
parent6b1d6f7d8efa741599b34762407cc787c8fa7141 (diff)
parent3ef04909b716ba1495b6ba1d4797f9f467941065 (diff)
downloadnextcloud-server-2053455b5655fa4bdcec5eef4fd0216e8a69baab.tar.gz
nextcloud-server-2053455b5655fa4bdcec5eef4fd0216e8a69baab.zip
Merge pull request #50563 from nextcloud/backport/50530/stable29
-rw-r--r--core/Command/Db/ConvertType.php9
-rw-r--r--lib/private/DB/ConnectionFactory.php12
2 files changed, 6 insertions, 15 deletions
diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php
index 4d95ee50c4e..fd0db129b7f 100644
--- a/core/Command/Db/ConvertType.php
+++ b/core/Command/Db/ConvertType.php
@@ -177,13 +177,6 @@ class ConvertType extends Command implements CompletionAwareInterface {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
- // WARNING:
- // Leave in place until #45257 is addressed to prevent data loss (hopefully in time for the next maintenance release)
- //
- throw new \InvalidArgumentException(
- 'This command is temporarily disabled (until the next maintenance release).'
- );
-
$this->validateInput($input, $output);
$this->readPassword($input, $output);
@@ -251,7 +244,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
protected function getToDBConnection(InputInterface $input, OutputInterface $output) {
$type = $input->getArgument('type');
- $connectionParams = $this->connectionFactory->createConnectionParams();
+ $connectionParams = $this->connectionFactory->createConnectionParams(type: $type);
$connectionParams = array_merge($connectionParams, [
'host' => $input->getArgument('hostname'),
'user' => $input->getArgument('username'),
diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php
index 34c628ce320..868170d9e41 100644
--- a/lib/private/DB/ConnectionFactory.php
+++ b/lib/private/DB/ConnectionFactory.php
@@ -120,7 +120,7 @@ class ConnectionFactory {
$normalizedType = $this->normalizeType($type);
$eventManager = new EventManager();
$eventManager->addEventSubscriber(new SetTransactionIsolationLevel());
- $connectionParams = $this->createConnectionParams('', $additionalConnectionParams);
+ $connectionParams = $this->createConnectionParams('', $additionalConnectionParams, $type);
switch ($normalizedType) {
case 'pgsql':
// pg_connect used by Doctrine DBAL does not support URI notation (enclosed in brackets)
@@ -187,12 +187,10 @@ class ConnectionFactory {
/**
* Create the connection parameters for the config
- *
- * @param string $configPrefix
- * @return array
*/
- public function createConnectionParams(string $configPrefix = '', array $additionalConnectionParams = []) {
- $type = $this->config->getValue('dbtype', 'sqlite');
+ public function createConnectionParams(string $configPrefix = '', array $additionalConnectionParams = [], ?string $type = null) {
+ // use provided type or if null use type from config
+ $type = $type ?? $this->config->getValue('dbtype', 'sqlite');
$connectionParams = array_merge($this->getDefaultConnectionParams($type), [
'user' => $this->config->getValue($configPrefix . 'dbuser', $this->config->getValue('dbuser', '')),
@@ -224,7 +222,7 @@ class ConnectionFactory {
'tablePrefix' => $connectionParams['tablePrefix']
];
- if ($this->config->getValue('mysql.utf8mb4', false)) {
+ if ($type === 'mysql' && $this->config->getValue('mysql.utf8mb4', false)) {
$connectionParams['defaultTableOptions'] = [
'collate' => 'utf8mb4_bin',
'charset' => 'utf8mb4',