summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-03-13 10:57:12 +0100
committerJulius Härtl <jus@bitgrid.net>2023-03-13 10:59:33 +0100
commitf00f4244d4b4bfb98ccb9d828d6a1033c8c94524 (patch)
treea942a8c4066c6eb986f3d7a63221c9f81e3b4596 /apps/files_versions
parent62e6a32899dcd079b1ff3623d7363241892011ca (diff)
downloadnextcloud-server-f00f4244d4b4bfb98ccb9d828d6a1033c8c94524.tar.gz
nextcloud-server-f00f4244d4b4bfb98ccb9d828d6a1033c8c94524.zip
fix: Check return type on rollback
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/Versions/VersionManager.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/files_versions/lib/Versions/VersionManager.php b/apps/files_versions/lib/Versions/VersionManager.php
index 5a2480d6233..b3b6d6f85e8 100644
--- a/apps/files_versions/lib/Versions/VersionManager.php
+++ b/apps/files_versions/lib/Versions/VersionManager.php
@@ -95,11 +95,14 @@ class VersionManager implements IVersionManager, INameableVersionBackend, IDelet
public function rollback(IVersion $version) {
$backend = $version->getBackend();
$result = $backend->rollback($version);
- \OC_Hook::emit('\OCP\Versions', 'rollback', [
- 'path' => $version->getVersionPath(),
- 'revision' => $version->getRevisionId(),
- 'node' => $version->getSourceFile(),
- ]);
+ // rollback doesn't have a return type yet and some implementations don't return anything
+ if ($result === null || $result === true) {
+ \OC_Hook::emit('\OCP\Versions', 'rollback', [
+ 'path' => $version->getVersionPath(),
+ 'revision' => $version->getRevisionId(),
+ 'node' => $version->getSourceFile(),
+ ]);
+ }
return $result;
}