summaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-03 09:24:54 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-03 09:24:54 +0100
commita5c80ba8bc689a67adb8fda7eba31892c3e254f9 (patch)
tree3d077835c2f2bc88ea13726b0f1029129e97d948 /lib/private/files
parent7fefd4f4d900de85201dafd9848f1212d4f6176d (diff)
parent0062888aafcad14d574787d985cf6780356137cc (diff)
downloadnextcloud-server-a5c80ba8bc689a67adb8fda7eba31892c3e254f9.tar.gz
nextcloud-server-a5c80ba8bc689a67adb8fda7eba31892c3e254f9.zip
Merge pull request #20894 from owncloud/post-delete-meta-view
Also add metadata for postDelete hooks triggered from the view
Diffstat (limited to 'lib/private/files')
-rw-r--r--lib/private/files/node/hookconnector.php19
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) {