diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2024-03-08 13:08:57 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2024-03-08 13:09:22 -0100 |
commit | 467c84ec53511b008c7d6ac0888645a381787288 (patch) | |
tree | fe2f3471f74d70068630c9dcbba36452346d1c72 /lib/public/Files/Events | |
parent | 9522ef849771392583b51a3f03812a429a666d01 (diff) | |
download | nextcloud-server-467c84ec53511b008c7d6ac0888645a381787288.tar.gz nextcloud-server-467c84ec53511b008c7d6ac0888645a381787288.zip |
feat(files): copy live photos
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/public/Files/Events')
4 files changed, 13 insertions, 47 deletions
diff --git a/lib/public/Files/Events/Node/AbstractNodeEvent.php b/lib/public/Files/Events/Node/AbstractNodeEvent.php index d6c1c6d0f95..768c0eda2d5 100644 --- a/lib/public/Files/Events/Node/AbstractNodeEvent.php +++ b/lib/public/Files/Events/Node/AbstractNodeEvent.php @@ -32,14 +32,12 @@ use OCP\Files\Node; * @since 20.0.0 */ abstract class AbstractNodeEvent extends Event { - /** @var Node */ - private $node; - /** * @since 20.0.0 */ - public function __construct(Node $node) { - $this->node = $node; + public function __construct( + private Node $node + ) { } /** diff --git a/lib/public/Files/Events/Node/AbstractNodesEvent.php b/lib/public/Files/Events/Node/AbstractNodesEvent.php index 6bd9bc32a88..d736ebf1635 100644 --- a/lib/public/Files/Events/Node/AbstractNodesEvent.php +++ b/lib/public/Files/Events/Node/AbstractNodesEvent.php @@ -32,17 +32,13 @@ use OCP\Files\Node; * @since 20.0.0 */ abstract class AbstractNodesEvent extends Event { - /** @var Node */ - private $source; - /** @var Node */ - private $target; - /** * @since 20.0.0 */ - public function __construct(Node $source, Node $target) { - $this->source = $source; - $this->target = $target; + public function __construct( + private Node $source, + private Node $target + ) { } /** diff --git a/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php b/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php index dd29a39a279..c0226a9b527 100644 --- a/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php +++ b/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php @@ -25,31 +25,17 @@ declare(strict_types=1); */ namespace OCP\Files\Events\Node; -use Exception; -use OCP\Files\Node; +use OCP\Exceptions\AbortedEventException; /** * @since 20.0.0 */ class BeforeNodeDeletedEvent extends AbstractNodeEvent { /** - * @since 20.0.0 - */ - public function __construct(Node $node, private bool &$run) { - parent::__construct($node); - } - - /** * @since 28.0.0 - * @return never + * @deprecated 29.0.0 - use OCP\Exceptions\AbortedEventException instead */ public function abortOperation(\Throwable $ex = null) { - $this->stopPropagation(); - $this->run = false; - if ($ex !== null) { - throw $ex; - } else { - throw new Exception('Operation aborted'); - } + throw new AbortedEventException($ex?->getMessage() ?? 'Operation aborted'); } } diff --git a/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php b/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php index c6876666713..4c2c566c8c6 100644 --- a/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php +++ b/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php @@ -25,31 +25,17 @@ declare(strict_types=1); */ namespace OCP\Files\Events\Node; -use Exception; -use OCP\Files\Node; +use OCP\Exceptions\AbortedEventException; /** * @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 + * @deprecated 29.0.0 - use OCP\Exceptions\AbortedEventException instead */ public function abortOperation(\Throwable $ex = null) { - $this->stopPropagation(); - $this->run = false; - if ($ex !== null) { - throw $ex; - } else { - throw new Exception('Operation aborted'); - } + throw new AbortedEventException($ex?->getMessage() ?? 'Operation aborted'); } } |