summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-02 10:12:54 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-02 10:12:54 +0100
commitc46ea3024836fc020ad6552ef7b579c3be1faf63 (patch)
tree9ab3c2315ed911b220c3469d3f3a154f167eb08c /lib
parentf840d8dee76c5130ebd20a0c14a322507af1c274 (diff)
parent0d63e95a5d05b4f357c0725c8476bbd0b056712b (diff)
downloadnextcloud-server-c46ea3024836fc020ad6552ef7b579c3be1faf63.tar.gz
nextcloud-server-c46ea3024836fc020ad6552ef7b579c3be1faf63.zip
Merge pull request #20865 from owncloud/post-delete-meta
Add metadata to post delete hooks
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/node/file.php3
-rw-r--r--lib/private/files/node/folder.php3
-rw-r--r--lib/private/files/node/nonexistingfile.php60
-rw-r--r--lib/private/files/node/nonexistingfolder.php60
4 files changed, 104 insertions, 22 deletions
diff --git a/lib/private/files/node/file.php b/lib/private/files/node/file.php
index f66f87bfc2d..735bee3fd59 100644
--- a/lib/private/files/node/file.php
+++ b/lib/private/files/node/file.php
@@ -99,8 +99,9 @@ class File extends Node implements \OCP\Files\File {
public function delete() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
$this->sendHooks(array('preDelete'));
+ $fileInfo = $this->getFileInfo();
$this->view->unlink($this->path);
- $nonExisting = new NonExistingFile($this->root, $this->view, $this->path);
+ $nonExisting = new NonExistingFile($this->root, $this->view, $this->path, $fileInfo);
$this->root->emit('\OC\Files', 'postDelete', array($nonExisting));
$this->exists = false;
$this->fileInfo = null;
diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php
index 9032c2bfb9d..be76b70b2ce 100644
--- a/lib/private/files/node/folder.php
+++ b/lib/private/files/node/folder.php
@@ -295,8 +295,9 @@ class Folder extends Node implements \OCP\Files\Folder {
public function delete() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
$this->sendHooks(array('preDelete'));
+ $fileInfo = $this->getFileInfo();
$this->view->rmdir($this->path);
- $nonExisting = new NonExistingFolder($this->root, $this->view, $this->path);
+ $nonExisting = new NonExistingFolder($this->root, $this->view, $this->path, $fileInfo);
$this->root->emit('\OC\Files', 'postDelete', array($nonExisting));
$this->exists = false;
} else {
diff --git a/lib/private/files/node/nonexistingfile.php b/lib/private/files/node/nonexistingfile.php
index b1de15d0535..68fb7d1b6f9 100644
--- a/lib/private/files/node/nonexistingfile.php
+++ b/lib/private/files/node/nonexistingfile.php
@@ -46,7 +46,11 @@ class NonExistingFile extends File {
}
public function getId() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getId();
+ } else {
+ throw new NotFoundException();
+ }
}
public function stat() {
@@ -54,35 +58,67 @@ class NonExistingFile extends File {
}
public function getMTime() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getMTime();
+ } else {
+ throw new NotFoundException();
+ }
}
public function getSize() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getSize();
+ } else {
+ throw new NotFoundException();
+ }
}
public function getEtag() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getEtag();
+ } else {
+ throw new NotFoundException();
+ }
}
public function getPermissions() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getPermissions();
+ } else {
+ throw new NotFoundException();
+ }
}
public function isReadable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isReadable();
+ } else {
+ throw new NotFoundException();
+ }
}
public function isUpdateable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isUpdateable();
+ } else {
+ throw new NotFoundException();
+ }
}
public function isDeletable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isDeletable();
+ } else {
+ throw new NotFoundException();
+ }
}
public function isShareable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isShareable();
+ } else {
+ throw new NotFoundException();
+ }
}
public function getContent() {
@@ -94,7 +130,11 @@ class NonExistingFile extends File {
}
public function getMimeType() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getMimeType();
+ } else {
+ throw new NotFoundException();
+ }
}
public function fopen($mode) {
diff --git a/lib/private/files/node/nonexistingfolder.php b/lib/private/files/node/nonexistingfolder.php
index be58103da90..5044eb524f5 100644
--- a/lib/private/files/node/nonexistingfolder.php
+++ b/lib/private/files/node/nonexistingfolder.php
@@ -47,7 +47,11 @@ class NonExistingFolder extends Folder {
}
public function getId() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getId();
+ } else {
+ throw new NotFoundException();
+ }
}
public function stat() {
@@ -55,35 +59,67 @@ class NonExistingFolder extends Folder {
}
public function getMTime() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getMTime();
+ } else {
+ throw new NotFoundException();
+ }
}
public function getSize() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getSize();
+ } else {
+ throw new NotFoundException();
+ }
}
public function getEtag() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getEtag();
+ } else {
+ throw new NotFoundException();
+ }
}
public function getPermissions() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::getPermissions();
+ } else {
+ throw new NotFoundException();
+ }
}
public function isReadable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isReadable();
+ } else {
+ throw new NotFoundException();
+ }
}
public function isUpdateable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isUpdateable();
+ } else {
+ throw new NotFoundException();
+ }
}
public function isDeletable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isDeletable();
+ } else {
+ throw new NotFoundException();
+ }
}
public function isShareable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isShareable();
+ } else {
+ throw new NotFoundException();
+ }
}
public function get($path) {
@@ -127,6 +163,10 @@ class NonExistingFolder extends Folder {
}
public function isCreatable() {
- throw new NotFoundException();
+ if ($this->fileInfo) {
+ return parent::isCreatable();
+ } else {
+ throw new NotFoundException();
+ }
}
}