Skip to content

Commit 914e23e

Browse files
committed
[BUGFIX] Prevent upgrade wizard from crashing when cruser_id field has been removed, resolves #381
1 parent 768dc92 commit 914e23e

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
2025-07-23 Francois Suter (Idéative) <typo3@ideative.ch>
22

33
* Consider only live records in mapping utility, resolves #384
4+
* Prevent upgrade wizard from crashing when cruser_id field has been removed, resolves #381
45

56
2025-06-07 Francois Suter (Idéative) <typo3@ideative.ch>
67

Classes/Updates/LogUsernameMigration.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,28 @@ public function executeUpdate(): bool
8585
return true;
8686
}
8787

88+
/**
89+
* Ensure that the cruser_id field is still there (the user might have already dropped it)
90+
*/
8891
public function updateNecessary(): bool
8992
{
90-
// It's hard to check whether an update is really necessary or not, and since the implications
91-
// are minimal, let's just always do it
92-
return true;
93+
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(self::TABLE_NAME);
94+
try {
95+
$result = $connection->executeQuery(
96+
sprintf(
97+
'SHOW COLUMNS FROM %s;',
98+
self::TABLE_NAME
99+
)
100+
);
101+
while ($row = $result->fetchAssociative()) {
102+
if ($row['Field'] === 'cruser_id') {
103+
return true;
104+
}
105+
}
106+
} catch (\Throwable $e) {
107+
return false;
108+
}
109+
return false;
93110
}
94111

95112
public function getPrerequisites(): array

0 commit comments

Comments
 (0)