From 883e92e5eaf1d0ac5fb71d7a0ed37ab548014f38 Mon Sep 17 00:00:00 2001 From: Andreas Wolf Date: Sat, 23 Mar 2013 15:30:38 +0100 Subject: [PATCH] [BUGFIX] Resource storage does not emit signals The ResourceStorage class should emit signals before and after most actions it performs. The emit*() methods are already there, but not called from the "action" methods. This commit adds the calls where missing. Change-Id: Icf1653975aa72762ab61c6d649207c5900e66b1d Resolves: #46587 Releases: 6.1, 6.0 Reviewed-on: https://review.typo3.org/19221 Reviewed-by: Alexander Opitz Reviewed-by: Wouter Wolters Reviewed-by: Tom Ruether Reviewed-by: Benjamin Mack Tested-by: Benjamin Mack Reviewed-on: https://review.typo3.org/19239 --- .../core/Classes/Resource/ResourceStorage.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/typo3/sysext/core/Classes/Resource/ResourceStorage.php b/typo3/sysext/core/Classes/Resource/ResourceStorage.php index 9060de82215d..952a74d9ea00 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceStorage.php +++ b/typo3/sysext/core/Classes/Resource/ResourceStorage.php @@ -985,12 +985,18 @@ class ResourceStorage { if (!$this->checkFileActionPermission('remove', $fileObject)) { throw new Exception\InsufficientFileAccessPermissionsException('You are not allowed to delete the file "' . $fileObject->getIdentifier() . '\'', 1319550425); } + + $this->emitPreFileDeleteSignal($fileObject); + $result = $this->driver->deleteFile($fileObject); if ($result === FALSE) { throw new Exception\FileOperationErrorException('Deleting the file "' . $fileObject->getIdentifier() . '\' failed.', 1329831691); } // Mark the file object as deleted $fileObject->setDeleted(); + + $this->emitPostFileDeleteSignal($fileObject); + return TRUE; } @@ -1260,6 +1266,9 @@ class ResourceStorage { if (!$this->checkFileActionPermission('write', $file)) { throw new Exception\InsufficientFileWritePermissionsException('You are not allowed to rename the file "' . $file->getIdentifier() . '\'', 1319219349); } + + $this->emitPreFileRenameSignal($file, $targetFileName); + // Call driver method to rename the file that also updates the file // object properties try { @@ -1269,6 +1278,9 @@ class ResourceStorage { } catch (\RuntimeException $e) { } + + $this->emitPostFileRenameSignal($file, $targetFileName); + return $file; } @@ -1462,7 +1474,9 @@ class ResourceStorage { if ($this->driver->folderExistsInFolder($newName, $folderObject)) { throw new \InvalidArgumentException('The folder ' . $newName . ' already exists in folder ' . $folderObject->getIdentifier(), 1325418870); } + $this->emitPreFolderRenameSignal($folderObject, $newName); + $fileObjects = $this->getAllFileObjectsInFolder($folderObject); try { $fileMappings = $this->driver->renameFolder($folderObject, $newName); @@ -1476,7 +1490,9 @@ class ResourceStorage { } catch (\Exception $e) { throw $e; } + $this->emitPostFolderRenameSignal($folderObject, $newName); + return $returnObject; } @@ -1496,9 +1512,13 @@ class ResourceStorage { if ($this->driver->isFolderEmpty($folderObject) && !$deleteRecursively) { throw new \RuntimeException('Could not delete folder "' . $folderObject->getIdentifier() . '" because it is not empty.', 1325952534); } + $this->emitPreFolderDeleteSignal($folderObject); + $result = $this->driver->deleteFolder($folderObject, $deleteRecursively); + $this->emitPostFolderDeleteSignal($folderObject); + return $result; } -- 2.20.1