diff options
author | Louis Chemineau <louis@chmn.me> | 2022-12-07 15:55:36 +0100 |
---|---|---|
committer | Louis (Rebase PR Action) <artonge@users.noreply.github.com> | 2023-01-26 10:12:23 +0000 |
commit | d8b479752d327f8901a84454c17fd3c6f701a98d (patch) | |
tree | f3123df4d850b3bc39c82078a68187ac5f6be123 /apps | |
parent | 53d736207c87485763f5cbfd04a4ea3067b6606d (diff) | |
download | nextcloud-server-d8b479752d327f8901a84454c17fd3c6f701a98d.tar.gz nextcloud-server-d8b479752d327f8901a84454c17fd3c6f701a98d.zip |
Fix hookconnector tests
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_versions/lib/Listener/FileEventsListener.php | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php index c28a5a4c999..4e476a1c948 100644 --- a/apps/files_versions/lib/Listener/FileEventsListener.php +++ b/apps/files_versions/lib/Listener/FileEventsListener.php @@ -118,12 +118,7 @@ class FileEventsListener implements IEventListener { return; } - $owner = $node->getOwner(); - // if ($owner === null) { - // return; - // } - $userFolder = $this->rootFolder->getUserFolder($owner->getUID()); - + $userFolder = $this->rootFolder->getUserFolder($node->getOwner()->getUID()); $path = $userFolder->getRelativePath($node->getPath()); $result = Storage::store($path); @@ -177,12 +172,7 @@ class FileEventsListener implements IEventListener { * mark file as "deleted" so that we can clean up the versions if the file is gone */ public function pre_remove_hook(Node $node): void { - $owner = $node->getOwner(); - // if ($owner === null) { - // return; - // } - $userFolder = $this->rootFolder->getUserFolder($owner->getUID()); - + $userFolder = $this->rootFolder->getUserFolder($node->getOwner()->getUID()); $path = $userFolder->getRelativePath($node->getPath()); Storage::markDeletedFile($path); $this->versionsDeleted[$node->getPath()] = $node; @@ -195,12 +185,7 @@ class FileEventsListener implements IEventListener { * of the stored versions along the actual file */ public function rename_hook(Node $source, Node $target): void { - $owner = $target->getOwner(); - // if ($owner === null) { - // return; - // } - $userFolder = $this->rootFolder->getUserFolder($owner->getUID()); - + $userFolder = $this->rootFolder->getUserFolder($target->getOwner()->getUID()); $oldPath = $userFolder->getRelativePath($source->getPath()); $newPath = $userFolder->getRelativePath($target->getPath()); Storage::renameOrCopy($oldPath, $newPath, 'rename'); @@ -213,12 +198,7 @@ class FileEventsListener implements IEventListener { * the stored versions to the new location */ public function copy_hook(Node $source, Node $target): void { - $owner = $target->getOwner(); - // if ($owner === null) { - // return; - // } - $userFolder = $this->rootFolder->getUserFolder($owner->getUID()); - + $userFolder = $this->rootFolder->getUserFolder($target->getOwner()->getUID()); $oldPath = $userFolder->getRelativePath($source->getPath()); $newPath = $userFolder->getRelativePath($target->getPath()); Storage::renameOrCopy($oldPath, $newPath, 'copy'); @@ -234,12 +214,7 @@ class FileEventsListener implements IEventListener { public function pre_renameOrCopy_hook(Node $source, Node $target): void { // if we rename a movable mount point, then the versions don't have // to be renamed - $owner = $source->getOwner(); - // if ($owner === null) { - // return; - // } - $userFolder = $this->rootFolder->getUserFolder($owner->getUID()); - + $userFolder = $this->rootFolder->getUserFolder($source->getOwner()->getUID()); $oldPath = $userFolder->getRelativePath($source->getPath()); $newPath = $userFolder->getRelativePath($target->getPath()); $absOldPath = Filesystem::normalizePath('/' . \OC_User::getUser() . '/files' . $oldPath); |