Skip to content

Commit

Permalink
fix: Make sure that rollback hook is triggered on all version backends
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Feb 13, 2023
1 parent e0946a1 commit 6f7fe63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 0 additions & 6 deletions apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,6 @@ public static function rollback(string $file, int $revision, IUser $user) {

$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);
Expand Down
8 changes: 7 additions & 1 deletion apps/files_versions/lib/Versions/VersionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ public function createVersion(IUser $user, FileInfo $file) {

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) {
Expand Down

0 comments on commit 6f7fe63

Please sign in to comment.