[BUGFIX] Check if file exists before deletion 47/40447/2
authorChristoph Lehmann <lehmann@networkteam.com>
Mon, 15 Jun 2015 08:16:34 +0000 (10:16 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Thu, 18 Jun 2015 13:09:28 +0000 (15:09 +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/40447
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/core/Classes/Resource/ResourceStorage.php

index 12f191e..12215c0 100644 (file)
@@ -1578,9 +1578,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) {