diff options
author | Louis Chemineau <louis@chmn.me> | 2023-11-29 19:05:35 +0100 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-11-30 09:44:51 +0000 |
commit | 86d88f6b00920eb1d87c498597a8f2528eeab60b (patch) | |
tree | f994a6b37f4479840fd695e099e1d00c45d6de25 /lib/public | |
parent | a1434af01e787ede6231b895d0d6056654b41342 (diff) | |
download | nextcloud-server-86d88f6b00920eb1d87c498597a8f2528eeab60b.tar.gz nextcloud-server-86d88f6b00920eb1d87c498597a8f2528eeab60b.zip |
Synchronize operation on live photo files
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php | 23 | ||||
-rw-r--r-- | lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php | 23 |
2 files changed, 46 insertions, 0 deletions
diff --git a/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php b/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php index 316a30fadd8..dd29a39a279 100644 --- a/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php +++ b/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.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 BeforeNodeDeletedEvent extends AbstractNodeEvent { + /** + * @since 20.0.0 + */ + public function __construct(Node $node, private bool &$run) { + parent::__construct($node); + } + + /** + * @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'); + } + } } 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'); + } + } } |