diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 2fd208cd3644e..cbd15f1cb3ed3 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -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); diff --git a/apps/files_versions/lib/Versions/VersionManager.php b/apps/files_versions/lib/Versions/VersionManager.php index bfae0937df81d..c11b429202bdf 100644 --- a/apps/files_versions/lib/Versions/VersionManager.php +++ b/apps/files_versions/lib/Versions/VersionManager.php @@ -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) {