diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-11-09 22:27:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 22:27:24 +0100 |
commit | 397c96967a39b18354ce87a0c81964d3abc7cdc1 (patch) | |
tree | 7a8ec34ba75fd34bdef12e703b6cb2c4079c5af6 /lib | |
parent | 743066a3d39332cd328a5a5eafe3026f25b1bfa2 (diff) | |
parent | 67958915da26eade597b1fcb3764f5c793fa27e1 (diff) | |
download | nextcloud-server-397c96967a39b18354ce87a0c81964d3abc7cdc1.tar.gz nextcloud-server-397c96967a39b18354ce87a0c81964d3abc7cdc1.zip |
Merge pull request #41365 from nextcloud/bugfix/noid/fix-emitted-events
fix(events): Make sure all `\OCP\Files::…` events are emitted with th…
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Node/Node.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index 1fdedd844ae..acd91c56d3f 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -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); } } |