diff options
Diffstat (limited to 'lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php')
-rw-r--r-- | lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php b/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php index efbef03e383..c6876666713 100644 --- a/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php +++ b/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php @@ -25,8 +25,31 @@ declare(strict_types=1); */ namespace OCP\Files\Events\Node; +use Exception; +use OCP\Files\Node; + /** * @since 20.0.0 */ class BeforeNodeRenamedEvent extends AbstractNodesEvent { + /** + * @since 20.0.0 + */ + public function __construct(Node $source, Node $target, private bool &$run) { + parent::__construct($source, $target); + } + + /** + * @since 28.0.0 + * @return never + */ + public function abortOperation(\Throwable $ex = null) { + $this->stopPropagation(); + $this->run = false; + if ($ex !== null) { + throw $ex; + } else { + throw new Exception('Operation aborted'); + } + } } |