fix: Check return type on rollback

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2023-03-13 10:57:12 +01:00
parent 62e6a32899
commit f00f4244d4
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF

View file

@ -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;
}