Merge pull request #41365 from nextcloud/bugfix/noid/fix-emitted-events

fix(events): Make sure all `\OCP\Files::…` events are emitted with th…
This commit is contained in:
Joas Schilling 2023-11-09 22:27:24 +01:00 committed by GitHub
commit 397c96967a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,7 +132,14 @@ class Node implements INode {
if (method_exists($this->root, 'emit')) {
$this->root->emit('\OC\Files', $hook, $args);
}
$dispatcher->dispatch('\OCP\Files::' . $hook, new GenericEvent($args));
if (in_array($hook, ['preWrite', 'postWrite', 'preCreate', 'postCreate', 'preTouch', 'postTouch', 'preDelete', 'postDelete'], true)) {
$event = new GenericEvent($args[0]);
} else {
$event = new GenericEvent($args);
}
$dispatcher->dispatch('\OCP\Files::' . $hook, $event);
}
}