From 587e83cc36a7eb7e9224e72066847869536ec2b7 Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Mon, 15 Jan 2018 15:54:57 +0100 Subject: [PATCH] [BUGFIX] impexp: Wrong FAL references after import Fix a case during ext:impexp FAL uid mapping where sys_file_reference end up pointing to wrong sys_file records in case new sys_file uids also already exist in import file, due to multiple mappings. Power the patch with a functional test - it fails without the change in Import.php and is ok with the change. See the test method comments for more details on what exactly is checked here. Change-Id: I472cad2652e8d6f5d30e4ebc68ff1ae93de71ea1 Resolves: #67188 Releases: master, 8.7, 7.6 Reviewed-on: https://review.typo3.org/55368 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- typo3/sysext/impexp/Classes/Import.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/impexp/Classes/Import.php b/typo3/sysext/impexp/Classes/Import.php index 172db45ee297..bcd3c6e5619f 100644 --- a/typo3/sysext/impexp/Classes/Import.php +++ b/typo3/sysext/impexp/Classes/Import.php @@ -580,10 +580,11 @@ class Import extends ImportExport } foreach ($this->dat['header']['records']['sys_file_reference'] as $sysFileReferenceUid => $_) { - $fileReferenceRecord = $this->dat['records']['sys_file_reference:' . $sysFileReferenceUid]['data']; - if ($fileReferenceRecord['uid_local'] == $oldFileUid) { - $fileReferenceRecord['uid_local'] = $newFileUid; - $this->dat['records']['sys_file_reference:' . $sysFileReferenceUid]['data'] = $fileReferenceRecord; + if (!isset($this->dat['records']['sys_file_reference:' . $sysFileReferenceUid]['hasBeenMapped']) + && $this->dat['records']['sys_file_reference:' . $sysFileReferenceUid]['data']['uid_local'] == $oldFileUid + ) { + $this->dat['records']['sys_file_reference:' . $sysFileReferenceUid]['hasBeenMapped'] = true; + $this->dat['records']['sys_file_reference:' . $sysFileReferenceUid]['data']['uid_local'] = $newFileUid; } } } -- GitLab