[BUGFIX] Check if file exists before deletion 38/40238/2
authorChristoph Lehmann <lehmann@networkteam.com>
Mon, 15 Jun 2015 08:16:34 +0000 (10:16 +0200)
committerAlexander Opitz <opitz.alexander@googlemail.com>
Thu, 18 Jun 2015 13:04:58 +0000 (15:04 +0200)
File deletion in "processed" folder no longer throws an exception when
trying to delete a file that does not exist.

Resolves: #67432
Releases: master, 6.2
Change-Id: I59acdcbb04725ce4425ca3f333093e5a870046ca
Reviewed-on: http://review.typo3.org/40238
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/sysext/core/Classes/Resource/ResourceStorage.php

index 092e0b8..86a7e89 100644 (file)
@@ -1560,9 +1560,11 @@ class ResourceStorage implements ResourceStorageInterface {
 
                $this->emitPreFileDeleteSignal($fileObject);
 
-               $result = $this->driver->deleteFile($fileObject->getIdentifier());
-               if ($result === FALSE) {
-                       throw new Exception\FileOperationErrorException('Deleting the file "' . $fileObject->getIdentifier() . '\' failed.', 1329831691);
+               if ($this->driver->fileExists($fileObject->getIdentifier())) {
+                       $result = $this->driver->deleteFile($fileObject->getIdentifier());
+                       if (!$result) {
+                               throw new Exception\FileOperationErrorException('Deleting the file "' . $fileObject->getIdentifier() . '\' failed.', 1329831691);
+                       }
                }
                // Mark the file object as deleted
                if ($fileObject instanceof File) {