Skip to content

Commit 2053455

Browse files
Merge pull request #50563 from nextcloud/backport/50530/stable29
2 parents 6b1d6f7 + 3ef0490 commit 2053455

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

core/Command/Db/ConvertType.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,6 @@ protected function readPassword(InputInterface $input, OutputInterface $output)
177177
}
178178

179179
protected function execute(InputInterface $input, OutputInterface $output): int {
180-
// WARNING:
181-
// Leave in place until #45257 is addressed to prevent data loss (hopefully in time for the next maintenance release)
182-
//
183-
throw new \InvalidArgumentException(
184-
'This command is temporarily disabled (until the next maintenance release).'
185-
);
186-
187180
$this->validateInput($input, $output);
188181
$this->readPassword($input, $output);
189182

@@ -251,7 +244,7 @@ protected function createSchema(Connection $fromDB, Connection $toDB, InputInter
251244

252245
protected function getToDBConnection(InputInterface $input, OutputInterface $output) {
253246
$type = $input->getArgument('type');
254-
$connectionParams = $this->connectionFactory->createConnectionParams();
247+
$connectionParams = $this->connectionFactory->createConnectionParams(type: $type);
255248
$connectionParams = array_merge($connectionParams, [
256249
'host' => $input->getArgument('hostname'),
257250
'user' => $input->getArgument('username'),

lib/private/DB/ConnectionFactory.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function getConnection(string $type, array $additionalConnectionParams):
120120
$normalizedType = $this->normalizeType($type);
121121
$eventManager = new EventManager();
122122
$eventManager->addEventSubscriber(new SetTransactionIsolationLevel());
123-
$connectionParams = $this->createConnectionParams('', $additionalConnectionParams);
123+
$connectionParams = $this->createConnectionParams('', $additionalConnectionParams, $type);
124124
switch ($normalizedType) {
125125
case 'pgsql':
126126
// pg_connect used by Doctrine DBAL does not support URI notation (enclosed in brackets)
@@ -187,12 +187,10 @@ public function isValidType($type) {
187187

188188
/**
189189
* Create the connection parameters for the config
190-
*
191-
* @param string $configPrefix
192-
* @return array
193190
*/
194-
public function createConnectionParams(string $configPrefix = '', array $additionalConnectionParams = []) {
195-
$type = $this->config->getValue('dbtype', 'sqlite');
191+
public function createConnectionParams(string $configPrefix = '', array $additionalConnectionParams = [], ?string $type = null) {
192+
// use provided type or if null use type from config
193+
$type = $type ?? $this->config->getValue('dbtype', 'sqlite');
196194

197195
$connectionParams = array_merge($this->getDefaultConnectionParams($type), [
198196
'user' => $this->config->getValue($configPrefix . 'dbuser', $this->config->getValue('dbuser', '')),
@@ -224,7 +222,7 @@ public function createConnectionParams(string $configPrefix = '', array $additio
224222
'tablePrefix' => $connectionParams['tablePrefix']
225223
];
226224

227-
if ($this->config->getValue('mysql.utf8mb4', false)) {
225+
if ($type === 'mysql' && $this->config->getValue('mysql.utf8mb4', false)) {
228226
$connectionParams['defaultTableOptions'] = [
229227
'collate' => 'utf8mb4_bin',
230228
'charset' => 'utf8mb4',

0 commit comments

Comments
 (0)