summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-02-13 14:30:40 +0100
committerJulius Härtl <jus@bitgrid.net>2023-03-13 10:52:35 +0100
commitcf46bd691566833ee60e8939872d16425f48a64e (patch)
treed8f4b4b3631f5bc09204c345186118ccf424ef99 /apps
parentade49e0b15e408bf00dd24f5641bd9a29a18f05c (diff)
downloadnextcloud-server-cf46bd691566833ee60e8939872d16425f48a64e.tar.gz
nextcloud-server-cf46bd691566833ee60e8939872d16425f48a64e.zip
fix: Make sure that rollback hook is triggered on all version backends
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_versions/lib/Storage.php6
-rw-r--r--apps/files_versions/lib/Versions/VersionManager.php8
2 files changed, 7 insertions, 7 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index 75ca7e4bcee..8fddf589a44 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -417,12 +417,6 @@ class Storage {
$node = $userFolder->get($file);
- // TODO: move away from those legacy hooks!
- \OC_Hook::emit('\OCP\Versions', 'rollback', [
- 'path' => $filename,
- 'revision' => $revision,
- 'node' => $node,
- ]);
return true;
} elseif ($versionCreated) {
self::deleteVersion($users_view, $version);
diff --git a/apps/files_versions/lib/Versions/VersionManager.php b/apps/files_versions/lib/Versions/VersionManager.php
index bfae0937df8..c11b429202b 100644
--- a/apps/files_versions/lib/Versions/VersionManager.php
+++ b/apps/files_versions/lib/Versions/VersionManager.php
@@ -94,7 +94,13 @@ class VersionManager implements IVersionManager, INameableVersionBackend, IDelet
public function rollback(IVersion $version) {
$backend = $version->getBackend();
- return $backend->rollback($version);
+ $result = $backend->rollback($version);
+ \OC_Hook::emit('\OCP\Versions', 'rollback', [
+ 'path' => \OC\Files\Filesystem::getView()->getRelativePath($version->getSourceFile()->getPath()),
+ 'revision' => $version->getRevisionId(),
+ 'node' => $version->getSourceFile(),
+ ]);
+ return $result;
}
public function read(IVersion $version) {