From 9ba9c8780af50c239338419f0d6568cd56d006d1 Mon Sep 17 00:00:00 2001
From: Thomas Hohn <thomas@hohn.dk>
Date: Tue, 7 Mar 2017 08:19:46 +0100
Subject: [PATCH] [BUGFIX] FileStorageExtractionTask breaks if file not found

Before the file is processed a extra check is done to be sure the file
exists. If the file doesn't exist it's marked as missing.

Resolves: #80061
Releases: master, 8.7
Change-Id: Ifda396b75d2ace0ce126057a4e118856b15c05e0
Reviewed-on: https://review.typo3.org/51969
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
---
 typo3/sysext/core/Classes/Resource/Index/Indexer.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/Resource/Index/Indexer.php b/typo3/sysext/core/Classes/Resource/Index/Indexer.php
index 7b631f5cbae3..2813fdd65616 100644
--- a/typo3/sysext/core/Classes/Resource/Index/Indexer.php
+++ b/typo3/sysext/core/Classes/Resource/Index/Indexer.php
@@ -106,7 +106,14 @@ class Indexer
         $fileIndexRecords = $this->getFileIndexRepository()->findInStorageWithIndexOutstanding($this->storage, $maximumFileCount);
         foreach ($fileIndexRecords as $indexRecord) {
             $fileObject = $this->getResourceFactory()->getFileObject($indexRecord['uid'], $indexRecord);
-            $this->extractMetaData($fileObject);
+            // Check for existence of file before extraction
+            if ($fileObject->exists()) {
+                $this->extractMetaData($fileObject);
+
+                // Mark file as missing and continue with next record
+            } else {
+                $this->getFileIndexRepository()->markFileAsMissing($indexRecord['uid']);
+            }
         }
     }
 
-- 
GitLab