Skip to content
Snippets Groups Projects
Commit 331244f0 authored by Markus Klein's avatar Markus Klein Committed by Christian Kuhn
Browse files

[BUGFIX] Correctly re-import extension static-data

The ext_tables_static+adt.sql data are now re-imported,
if its data changed, when setting up the extensions.

This happens either from within the Extension Manager,
or via the CLI  command.

Moreover, a legacy value, which was already taken care of
in `ReloadSqlDataViewHelper`, is now respected as well.

Resolves: #102376
Releases: main, 12.4
Change-Id: I67074f8b98acd0bbfc7ce03732b18f759e1d81de
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81749


Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarThomas Hohn <tho@gyldendal.dk>
parent 54530b44
No related merge requests found
......@@ -320,14 +320,20 @@ class InstallUtility implements LoggerAwareInterface
{
$extTablesStaticSqlFile = $packagePath . 'ext_tables_static+adt.sql';
$extTablesStaticSqlRelFile = PathUtility::stripPathSitePrefix($extTablesStaticSqlFile);
if (!$this->registry->get('extensionDataImport', $extTablesStaticSqlRelFile)) {
$shortFileHash = '';
if (file_exists($extTablesStaticSqlFile)) {
$extTablesStaticSqlContent = (string)file_get_contents($extTablesStaticSqlFile);
$shortFileHash = md5($extTablesStaticSqlContent);
$oldHash = $this->registry->get('extensionDataImport', $extTablesStaticSqlRelFile);
$shortFileHash = '';
// We used to only store "1" in the database when data was imported
$needsUpdate = !$oldHash || $oldHash === 1;
if (file_exists($extTablesStaticSqlFile)) {
$extTablesStaticSqlContent = (string)file_get_contents($extTablesStaticSqlFile);
$shortFileHash = hash('xxh3', $extTablesStaticSqlContent);
$needsUpdate = $oldHash !== $shortFileHash;
if ($needsUpdate) {
$statements = $this->sqlReader->getStatementArray($extTablesStaticSqlContent);
$this->schemaMigrator->importStaticData($statements, true);
}
}
if ($needsUpdate) {
$this->registry->set('extensionDataImport', $extTablesStaticSqlRelFile, $shortFileHash);
$this->eventDispatcher->dispatch(new AfterExtensionStaticDatabaseContentHasBeenImportedEvent($extensionKey, $extTablesStaticSqlFile, $this));
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment