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 committed by Arthur Schiwon
parent 69998422d5
commit 5b77597c52
No known key found for this signature in database
GPG key ID: 7424F1874854DF23

View file

@ -100,11 +100,14 @@ class VersionManager implements IVersionManager {
public function rollback(IVersion $version) {
$backend = $version->getBackend();
$result = self::handleAppLocks(fn(): ?bool => $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;
}