Skip to content

Commit b210700

Browse files
Nils Wenninghoffprovokateurin
authored andcommitted
fix(ConvertType): Read dbtype in createConnectionParams and remove safeguard
Signed-off-by: Nils Wenninghoff <nils@ungemein.cool>
1 parent e84a12c commit b210700

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
@@ -152,13 +152,6 @@ protected function readPassword(InputInterface $input, OutputInterface $output)
152152
}
153153

154154
protected function execute(InputInterface $input, OutputInterface $output): int {
155-
// WARNING:
156-
// Leave in place until #45257 is addressed to prevent data loss (hopefully in time for the next maintenance release)
157-
//
158-
throw new \InvalidArgumentException(
159-
'This command is temporarily disabled (until the next maintenance release).'
160-
);
161-
162155
$this->validateInput($input, $output);
163156
$this->readPassword($input, $output);
164157

@@ -226,7 +219,7 @@ protected function createSchema(Connection $fromDB, Connection $toDB, InputInter
226219

227220
protected function getToDBConnection(InputInterface $input, OutputInterface $output) {
228221
$type = $input->getArgument('type');
229-
$connectionParams = $this->connectionFactory->createConnectionParams();
222+
$connectionParams = $this->connectionFactory->createConnectionParams(type: $type);
230223
$connectionParams = array_merge($connectionParams, [
231224
'host' => $input->getArgument('hostname'),
232225
'user' => $input->getArgument('username'),

lib/private/DB/ConnectionFactory.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function getConnection(string $type, array $additionalConnectionParams):
108108
$normalizedType = $this->normalizeType($type);
109109
$eventManager = new EventManager();
110110
$eventManager->addEventSubscriber(new SetTransactionIsolationLevel());
111-
$connectionParams = $this->createConnectionParams('', $additionalConnectionParams);
111+
$connectionParams = $this->createConnectionParams('', $additionalConnectionParams, $type);
112112
switch ($normalizedType) {
113113
case 'pgsql':
114114
// pg_connect used by Doctrine DBAL does not support URI notation (enclosed in brackets)
@@ -175,12 +175,10 @@ public function isValidType($type) {
175175

176176
/**
177177
* Create the connection parameters for the config
178-
*
179-
* @param string $configPrefix
180-
* @return array
181178
*/
182-
public function createConnectionParams(string $configPrefix = '', array $additionalConnectionParams = []) {
183-
$type = $this->config->getValue('dbtype', 'sqlite');
179+
public function createConnectionParams(string $configPrefix = '', array $additionalConnectionParams = [], ?string $type = null) {
180+
// use provided type or if null use type from config
181+
$type = $type ?? $this->config->getValue('dbtype', 'sqlite');
184182

185183
$connectionParams = array_merge($this->getDefaultConnectionParams($type), [
186184
'user' => $this->config->getValue($configPrefix . 'dbuser', $this->config->getValue('dbuser', '')),
@@ -212,7 +210,7 @@ public function createConnectionParams(string $configPrefix = '', array $additio
212210
'tablePrefix' => $connectionParams['tablePrefix']
213211
];
214212

215-
if ($this->config->getValue('mysql.utf8mb4', false)) {
213+
if ($type === 'mysql' && $this->config->getValue('mysql.utf8mb4', false)) {
216214
$connectionParams['defaultTableOptions'] = [
217215
'collate' => 'utf8mb4_bin',
218216
'charset' => 'utf8mb4',

0 commit comments

Comments
 (0)