diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-12-02 13:19:19 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-12-02 13:51:26 +0100 |
commit | 0062888aafcad14d574787d985cf6780356137cc (patch) | |
tree | 560886b8d02928334dcaa349684f757da73ee4b6 /lib/private | |
parent | 8d218bf3ef842d76c2b97a175b28e13054497952 (diff) | |
download | nextcloud-server-0062888aafcad14d574787d985cf6780356137cc.tar.gz nextcloud-server-0062888aafcad14d574787d985cf6780356137cc.zip |
Also add metadata for postDelete hooks triggered from the view
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/files/node/hookconnector.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/private/files/node/hookconnector.php b/lib/private/files/node/hookconnector.php index c42a329d319..360aaafdd71 100644 --- a/lib/private/files/node/hookconnector.php +++ b/lib/private/files/node/hookconnector.php @@ -21,9 +21,9 @@ namespace OC\Files\Node; +use OCP\Files\FileInfo; use OC\Files\Filesystem; use OC\Files\View; -use OCP\Files\FileInfo; use OCP\Util; class HookConnector { @@ -38,6 +38,11 @@ class HookConnector { private $view; /** + * @var FileInfo[] + */ + private $deleteMetaCache = []; + + /** * HookConnector constructor. * * @param Root $root @@ -90,11 +95,13 @@ class HookConnector { public function delete($arguments) { $node = $this->getNodeForPath($arguments['path']); + $this->deleteMetaCache[$node->getPath()] = $node->getFileInfo(); $this->root->emit('\OC\Files', 'preDelete', [$node]); } public function postDelete($arguments) { $node = $this->getNodeForPath($arguments['path']); + unset($this->deleteMetaCache[$node->getPath()]); $this->root->emit('\OC\Files', 'postDelete', [$node]); } @@ -135,11 +142,17 @@ class HookConnector { private function getNodeForPath($path) { $info = Filesystem::getView()->getFileInfo($path); if (!$info) { + $fullPath = Filesystem::getView()->getAbsolutePath($path); + if (isset($this->deleteMetaCache[$fullPath])) { + $info = $this->deleteMetaCache[$fullPath]; + } else { + $info = null; + } if (Filesystem::is_dir($path)) { - return new NonExistingFolder($this->root, $this->view, $fullPath); + return new NonExistingFolder($this->root, $this->view, $fullPath, $info); } else { - return new NonExistingFile($this->root, $this->view, $fullPath); + return new NonExistingFile($this->root, $this->view, $fullPath, $info); } } if ($info->getType() === FileInfo::TYPE_FILE) { |