From 7b3bbf6d9da594751890120c2e548ad8ed2ee3d6 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 19 Jun 2023 10:13:17 +0200 Subject: [PATCH] Do not download already existing files during import (#26) The usual use cases right now would involve a new file with a new URL. That way we don't need to download existing files again. That reduced network traffic, execution time and resource usage. --- .../DestinationDataImportService/FilesAssignment.php | 6 +----- Documentation/Changelog/3.4.0.rst | 1 + Documentation/Features/ImportDestinationOne.rst | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Classes/Service/DestinationDataImportService/FilesAssignment.php b/Classes/Service/DestinationDataImportService/FilesAssignment.php index 3c5e174..11302a9 100644 --- a/Classes/Service/DestinationDataImportService/FilesAssignment.php +++ b/Classes/Service/DestinationDataImportService/FilesAssignment.php @@ -93,11 +93,7 @@ class FilesAssignment if ($importFolder->hasFile($orgFileNameSanitized)) { $this->logger->info('File already exists.', [$orgFileNameSanitized]); - } else { - $this->logger->info('File does not exist.', [$orgFileNameSanitized]); - } - - if ($filename = $this->loadFile($fileUrl)) { + } elseif ($filename = $this->loadFile($fileUrl)) { $this->logger->info('Adding file to FAL.', [$filename]); $importFolder->addFile($filename, basename($fileUrl), DuplicationBehavior::REPLACE); } else { diff --git a/Documentation/Changelog/3.4.0.rst b/Documentation/Changelog/3.4.0.rst index be63657..b5e4bfe 100644 --- a/Documentation/Changelog/3.4.0.rst +++ b/Documentation/Changelog/3.4.0.rst @@ -34,6 +34,7 @@ Features * Handle changes to images for events. The import of destination data one only added new images but kept existing images untouched. This was now improved. The import now will update, remove and re-sort images as well. + Existing image files won't be downloaded again, only information and position are updated. Fixes ----- diff --git a/Documentation/Features/ImportDestinationOne.rst b/Documentation/Features/ImportDestinationOne.rst index cc519c5..3fc13fa 100644 --- a/Documentation/Features/ImportDestinationOne.rst +++ b/Documentation/Features/ImportDestinationOne.rst @@ -21,6 +21,7 @@ The import will: * Flush all dates for updated events and re-create all dates. * Add and update all images for updated and added events. + Existing image files won't be downloaded again, only information and position are updated. The import will not: