aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Files/Events
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Files/Events')
-rw-r--r--lib/public/Files/Events/BeforeDirectFileDownloadEvent.php69
-rw-r--r--lib/public/Files/Events/BeforeFileScannedEvent.php37
-rw-r--r--lib/public/Files/Events/BeforeFileSystemSetupEvent.php36
-rw-r--r--lib/public/Files/Events/BeforeFolderScannedEvent.php37
-rw-r--r--lib/public/Files/Events/BeforeZipCreatedEvent.php98
-rw-r--r--lib/public/Files/Events/FileCacheUpdated.php51
-rw-r--r--lib/public/Files/Events/FileScannedEvent.php37
-rw-r--r--lib/public/Files/Events/FolderScannedEvent.php37
-rw-r--r--lib/public/Files/Events/InvalidateMountCacheEvent.php40
-rw-r--r--lib/public/Files/Events/Node/AbstractNodeEvent.php43
-rw-r--r--lib/public/Files/Events/Node/AbstractNodesEvent.php52
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeCopiedEvent.php15
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeCreatedEvent.php15
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php24
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeReadEvent.php15
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php24
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeTouchedEvent.php15
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeWrittenEvent.php15
-rw-r--r--lib/public/Files/Events/Node/FilesystemTornDownEvent.php19
-rw-r--r--lib/public/Files/Events/Node/NodeCopiedEvent.php15
-rw-r--r--lib/public/Files/Events/Node/NodeCreatedEvent.php15
-rw-r--r--lib/public/Files/Events/Node/NodeDeletedEvent.php15
-rw-r--r--lib/public/Files/Events/Node/NodeRenamedEvent.php15
-rw-r--r--lib/public/Files/Events/Node/NodeTouchedEvent.php15
-rw-r--r--lib/public/Files/Events/Node/NodeWrittenEvent.php15
-rw-r--r--lib/public/Files/Events/NodeAddedToCache.php51
-rw-r--r--lib/public/Files/Events/NodeAddedToFavorite.php49
-rw-r--r--lib/public/Files/Events/NodeRemovedFromCache.php51
-rw-r--r--lib/public/Files/Events/NodeRemovedFromFavorite.php49
29 files changed, 969 insertions, 0 deletions
diff --git a/lib/public/Files/Events/BeforeDirectFileDownloadEvent.php b/lib/public/Files/Events/BeforeDirectFileDownloadEvent.php
new file mode 100644
index 00000000000..550a5e17496
--- /dev/null
+++ b/lib/public/Files/Events/BeforeDirectFileDownloadEvent.php
@@ -0,0 +1,69 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * This event is triggered when a user tries to download a file
+ * directly.
+ *
+ * @since 25.0.0
+ */
+class BeforeDirectFileDownloadEvent extends Event {
+ private string $path;
+ private bool $successful = true;
+ private ?string $errorMessage = null;
+
+ /**
+ * @since 25.0.0
+ */
+ public function __construct(string $path) {
+ parent::__construct();
+ $this->path = $path;
+ }
+
+ /**
+ * @since 25.0.0
+ */
+ public function getPath(): string {
+ return $this->path;
+ }
+
+ /**
+ * @since 25.0.0
+ */
+ public function isSuccessful(): bool {
+ return $this->successful;
+ }
+
+ /**
+ * Set if the event was successful
+ *
+ * @since 25.0.0
+ */
+ public function setSuccessful(bool $successful): void {
+ $this->successful = $successful;
+ }
+
+ /**
+ * Get the error message, if any
+ * @since 25.0.0
+ */
+ public function getErrorMessage(): ?string {
+ return $this->errorMessage;
+ }
+
+ /**
+ * @since 25.0.0
+ */
+ public function setErrorMessage(string $errorMessage): void {
+ $this->errorMessage = $errorMessage;
+ }
+}
diff --git a/lib/public/Files/Events/BeforeFileScannedEvent.php b/lib/public/Files/Events/BeforeFileScannedEvent.php
new file mode 100644
index 00000000000..70c9d23c156
--- /dev/null
+++ b/lib/public/Files/Events/BeforeFileScannedEvent.php
@@ -0,0 +1,37 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * @since 18.0.0
+ */
+class BeforeFileScannedEvent extends Event {
+ /** @var string */
+ private $absolutePath;
+
+ /**
+ * @param string $absolutePath
+ *
+ * @since 18.0.0
+ */
+ public function __construct(string $absolutePath) {
+ parent::__construct();
+ $this->absolutePath = $absolutePath;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getAbsolutePath(): string {
+ return $this->absolutePath;
+ }
+}
diff --git a/lib/public/Files/Events/BeforeFileSystemSetupEvent.php b/lib/public/Files/Events/BeforeFileSystemSetupEvent.php
new file mode 100644
index 00000000000..23791aa6ec1
--- /dev/null
+++ b/lib/public/Files/Events/BeforeFileSystemSetupEvent.php
@@ -0,0 +1,36 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * Event triggered before the file system is setup
+ *
+ * @since 31.0.0
+ */
+class BeforeFileSystemSetupEvent extends Event {
+ /**
+ * @since 31.0.0
+ */
+ public function __construct(
+ private IUser $user,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @since 31.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+}
diff --git a/lib/public/Files/Events/BeforeFolderScannedEvent.php b/lib/public/Files/Events/BeforeFolderScannedEvent.php
new file mode 100644
index 00000000000..cd72c79e8d8
--- /dev/null
+++ b/lib/public/Files/Events/BeforeFolderScannedEvent.php
@@ -0,0 +1,37 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * @since 18.0.0
+ */
+class BeforeFolderScannedEvent extends Event {
+ /** @var string */
+ private $absolutePath;
+
+ /**
+ * @param string $absolutePath
+ *
+ * @since 18.0.0
+ */
+ public function __construct(string $absolutePath) {
+ parent::__construct();
+ $this->absolutePath = $absolutePath;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getAbsolutePath(): string {
+ return $this->absolutePath;
+ }
+}
diff --git a/lib/public/Files/Events/BeforeZipCreatedEvent.php b/lib/public/Files/Events/BeforeZipCreatedEvent.php
new file mode 100644
index 00000000000..0363d385d36
--- /dev/null
+++ b/lib/public/Files/Events/BeforeZipCreatedEvent.php
@@ -0,0 +1,98 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\Files\Folder;
+
+/**
+ * This event is triggered before a archive is created when a user requested
+ * downloading a folder or multiple files.
+ *
+ * By setting `successful` to false the tar creation can be aborted and the download denied.
+ *
+ * @since 25.0.0
+ */
+class BeforeZipCreatedEvent extends Event {
+ private string $directory;
+ private bool $successful = true;
+ private ?string $errorMessage = null;
+ private ?Folder $folder = null;
+
+ /**
+ * @param list<string> $files
+ * @since 25.0.0
+ * @since 31.0.0 support `OCP\Files\Folder` as `$directory` parameter - passing a string is deprecated now
+ */
+ public function __construct(
+ string|Folder $directory,
+ private array $files,
+ ) {
+ parent::__construct();
+ if ($directory instanceof Folder) {
+ $this->directory = $directory->getPath();
+ $this->folder = $directory;
+ } else {
+ $this->directory = $directory;
+ }
+ }
+
+ /**
+ * @since 31.0.0
+ */
+ public function getFolder(): ?Folder {
+ return $this->folder;
+ }
+
+ /**
+ * @since 25.0.0
+ */
+ public function getDirectory(): string {
+ return $this->directory;
+ }
+
+ /**
+ * @since 25.0.0
+ */
+ public function getFiles(): array {
+ return $this->files;
+ }
+
+ /**
+ * @since 25.0.0
+ */
+ public function isSuccessful(): bool {
+ return $this->successful;
+ }
+
+ /**
+ * Set if the event was successful
+ *
+ * @since 25.0.0
+ */
+ public function setSuccessful(bool $successful): void {
+ $this->successful = $successful;
+ }
+
+ /**
+ * Get the error message, if any
+ * @since 25.0.0
+ */
+ public function getErrorMessage(): ?string {
+ return $this->errorMessage;
+ }
+
+ /**
+ * @since 25.0.0
+ */
+ public function setErrorMessage(string $errorMessage): void {
+ $this->errorMessage = $errorMessage;
+ }
+}
diff --git a/lib/public/Files/Events/FileCacheUpdated.php b/lib/public/Files/Events/FileCacheUpdated.php
new file mode 100644
index 00000000000..7b3877bb05d
--- /dev/null
+++ b/lib/public/Files/Events/FileCacheUpdated.php
@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\Files\Storage\IStorage;
+
+/**
+ * @since 18.0.0
+ */
+class FileCacheUpdated extends Event {
+ /** @var IStorage */
+ private $storage;
+
+ /** @var string */
+ private $path;
+
+ /**
+ * @param IStorage $storage
+ * @param string $path
+ * @since 18.0.0
+ */
+ public function __construct(IStorage $storage,
+ string $path) {
+ parent::__construct();
+ $this->storage = $storage;
+ $this->path = $path;
+ }
+
+ /**
+ * @return IStorage
+ * @since 18.0.0
+ */
+ public function getStorage(): IStorage {
+ return $this->storage;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getPath(): string {
+ return $this->path;
+ }
+}
diff --git a/lib/public/Files/Events/FileScannedEvent.php b/lib/public/Files/Events/FileScannedEvent.php
new file mode 100644
index 00000000000..9ede4e2425f
--- /dev/null
+++ b/lib/public/Files/Events/FileScannedEvent.php
@@ -0,0 +1,37 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * @since 18.0.0
+ */
+class FileScannedEvent extends Event {
+ /** @var string */
+ private $absolutePath;
+
+ /**
+ * @param string $absolutePath
+ *
+ * @since 18.0.0
+ */
+ public function __construct(string $absolutePath) {
+ parent::__construct();
+ $this->absolutePath = $absolutePath;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getAbsolutePath(): string {
+ return $this->absolutePath;
+ }
+}
diff --git a/lib/public/Files/Events/FolderScannedEvent.php b/lib/public/Files/Events/FolderScannedEvent.php
new file mode 100644
index 00000000000..5e14bbfb6a8
--- /dev/null
+++ b/lib/public/Files/Events/FolderScannedEvent.php
@@ -0,0 +1,37 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * @since 18.0.0
+ */
+class FolderScannedEvent extends Event {
+ /** @var string */
+ private $absolutePath;
+
+ /**
+ * @param string $absolutePath
+ *
+ * @since 18.0.0
+ */
+ public function __construct(string $absolutePath) {
+ parent::__construct();
+ $this->absolutePath = $absolutePath;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getAbsolutePath(): string {
+ return $this->absolutePath;
+ }
+}
diff --git a/lib/public/Files/Events/InvalidateMountCacheEvent.php b/lib/public/Files/Events/InvalidateMountCacheEvent.php
new file mode 100644
index 00000000000..a29281ddcec
--- /dev/null
+++ b/lib/public/Files/Events/InvalidateMountCacheEvent.php
@@ -0,0 +1,40 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * Used to notify the filesystem setup manager that the available mounts for a user have changed
+ *
+ * @since 24.0.0
+ */
+class InvalidateMountCacheEvent extends Event {
+ private ?IUser $user;
+
+ /**
+ * @param IUser|null $user user
+ *
+ * @since 24.0.0
+ */
+ public function __construct(?IUser $user) {
+ parent::__construct();
+ $this->user = $user;
+ }
+
+ /**
+ * @return IUser|null user
+ *
+ * @since 24.0.0
+ */
+ public function getUser(): ?IUser {
+ return $this->user;
+ }
+}
diff --git a/lib/public/Files/Events/Node/AbstractNodeEvent.php b/lib/public/Files/Events/Node/AbstractNodeEvent.php
new file mode 100644
index 00000000000..7afb71277f6
--- /dev/null
+++ b/lib/public/Files/Events/Node/AbstractNodeEvent.php
@@ -0,0 +1,43 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IWebhookCompatibleEvent;
+use OCP\EventDispatcher\JsonSerializer;
+use OCP\Files\Node;
+
+/**
+ * @since 20.0.0
+ */
+abstract class AbstractNodeEvent extends Event implements IWebhookCompatibleEvent {
+ /**
+ * @since 20.0.0
+ */
+ public function __construct(
+ private Node $node,
+ ) {
+ }
+
+ /**
+ * @since 20.0.0
+ */
+ public function getNode(): Node {
+ return $this->node;
+ }
+
+ /**
+ * @since 30.0.0
+ */
+ public function getWebhookSerializable(): array {
+ return [
+ 'node' => JsonSerializer::serializeFileInfo($this->node),
+ ];
+ }
+}
diff --git a/lib/public/Files/Events/Node/AbstractNodesEvent.php b/lib/public/Files/Events/Node/AbstractNodesEvent.php
new file mode 100644
index 00000000000..8fa8795d1df
--- /dev/null
+++ b/lib/public/Files/Events/Node/AbstractNodesEvent.php
@@ -0,0 +1,52 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IWebhookCompatibleEvent;
+use OCP\EventDispatcher\JsonSerializer;
+use OCP\Files\Node;
+
+/**
+ * @since 20.0.0
+ */
+abstract class AbstractNodesEvent extends Event implements IWebhookCompatibleEvent {
+ /**
+ * @since 20.0.0
+ */
+ public function __construct(
+ private Node $source,
+ private Node $target,
+ ) {
+ }
+
+ /**
+ * @since 20.0.0
+ */
+ public function getSource(): Node {
+ return $this->source;
+ }
+
+ /**
+ * @since 20.0.0
+ */
+ public function getTarget(): Node {
+ return $this->target;
+ }
+
+ /**
+ * @since 30.0.0
+ */
+ public function getWebhookSerializable(): array {
+ return [
+ 'source' => JsonSerializer::serializeFileInfo($this->source),
+ 'target' => JsonSerializer::serializeFileInfo($this->target),
+ ];
+ }
+}
diff --git a/lib/public/Files/Events/Node/BeforeNodeCopiedEvent.php b/lib/public/Files/Events/Node/BeforeNodeCopiedEvent.php
new file mode 100644
index 00000000000..c7c014cfd64
--- /dev/null
+++ b/lib/public/Files/Events/Node/BeforeNodeCopiedEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class BeforeNodeCopiedEvent extends AbstractNodesEvent {
+}
diff --git a/lib/public/Files/Events/Node/BeforeNodeCreatedEvent.php b/lib/public/Files/Events/Node/BeforeNodeCreatedEvent.php
new file mode 100644
index 00000000000..3f42687576d
--- /dev/null
+++ b/lib/public/Files/Events/Node/BeforeNodeCreatedEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class BeforeNodeCreatedEvent extends AbstractNodeEvent {
+}
diff --git a/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php b/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php
new file mode 100644
index 00000000000..83d9402dbeb
--- /dev/null
+++ b/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php
@@ -0,0 +1,24 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+use OCP\Exceptions\AbortedEventException;
+
+/**
+ * @since 20.0.0
+ */
+class BeforeNodeDeletedEvent extends AbstractNodeEvent {
+ /**
+ * @since 28.0.0
+ * @deprecated 29.0.0 - use OCP\Exceptions\AbortedEventException instead
+ */
+ public function abortOperation(?\Throwable $ex = null) {
+ throw new AbortedEventException($ex?->getMessage() ?? 'Operation aborted');
+ }
+}
diff --git a/lib/public/Files/Events/Node/BeforeNodeReadEvent.php b/lib/public/Files/Events/Node/BeforeNodeReadEvent.php
new file mode 100644
index 00000000000..ae688fccb30
--- /dev/null
+++ b/lib/public/Files/Events/Node/BeforeNodeReadEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class BeforeNodeReadEvent extends AbstractNodeEvent {
+}
diff --git a/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php b/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php
new file mode 100644
index 00000000000..54714b8f7e2
--- /dev/null
+++ b/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php
@@ -0,0 +1,24 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+use OCP\Exceptions\AbortedEventException;
+
+/**
+ * @since 20.0.0
+ */
+class BeforeNodeRenamedEvent extends AbstractNodesEvent {
+ /**
+ * @since 28.0.0
+ * @deprecated 29.0.0 - use OCP\Exceptions\AbortedEventException instead
+ */
+ public function abortOperation(?\Throwable $ex = null) {
+ throw new AbortedEventException($ex?->getMessage() ?? 'Operation aborted');
+ }
+}
diff --git a/lib/public/Files/Events/Node/BeforeNodeTouchedEvent.php b/lib/public/Files/Events/Node/BeforeNodeTouchedEvent.php
new file mode 100644
index 00000000000..ed2e561e947
--- /dev/null
+++ b/lib/public/Files/Events/Node/BeforeNodeTouchedEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class BeforeNodeTouchedEvent extends AbstractNodeEvent {
+}
diff --git a/lib/public/Files/Events/Node/BeforeNodeWrittenEvent.php b/lib/public/Files/Events/Node/BeforeNodeWrittenEvent.php
new file mode 100644
index 00000000000..61d3afb9cd6
--- /dev/null
+++ b/lib/public/Files/Events/Node/BeforeNodeWrittenEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class BeforeNodeWrittenEvent extends AbstractNodeEvent {
+}
diff --git a/lib/public/Files/Events/Node/FilesystemTornDownEvent.php b/lib/public/Files/Events/Node/FilesystemTornDownEvent.php
new file mode 100644
index 00000000000..2076b739b51
--- /dev/null
+++ b/lib/public/Files/Events/Node/FilesystemTornDownEvent.php
@@ -0,0 +1,19 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Files\Events\Node;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * Event fired after the filesystem has been torn down
+ *
+ * @since 24.0.0
+ */
+class FilesystemTornDownEvent extends Event {
+}
diff --git a/lib/public/Files/Events/Node/NodeCopiedEvent.php b/lib/public/Files/Events/Node/NodeCopiedEvent.php
new file mode 100644
index 00000000000..8913f34835e
--- /dev/null
+++ b/lib/public/Files/Events/Node/NodeCopiedEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class NodeCopiedEvent extends AbstractNodesEvent {
+}
diff --git a/lib/public/Files/Events/Node/NodeCreatedEvent.php b/lib/public/Files/Events/Node/NodeCreatedEvent.php
new file mode 100644
index 00000000000..ffcbc9a9f10
--- /dev/null
+++ b/lib/public/Files/Events/Node/NodeCreatedEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class NodeCreatedEvent extends AbstractNodeEvent {
+}
diff --git a/lib/public/Files/Events/Node/NodeDeletedEvent.php b/lib/public/Files/Events/Node/NodeDeletedEvent.php
new file mode 100644
index 00000000000..58689e2c3d9
--- /dev/null
+++ b/lib/public/Files/Events/Node/NodeDeletedEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class NodeDeletedEvent extends AbstractNodeEvent {
+}
diff --git a/lib/public/Files/Events/Node/NodeRenamedEvent.php b/lib/public/Files/Events/Node/NodeRenamedEvent.php
new file mode 100644
index 00000000000..f126d191d7f
--- /dev/null
+++ b/lib/public/Files/Events/Node/NodeRenamedEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class NodeRenamedEvent extends AbstractNodesEvent {
+}
diff --git a/lib/public/Files/Events/Node/NodeTouchedEvent.php b/lib/public/Files/Events/Node/NodeTouchedEvent.php
new file mode 100644
index 00000000000..88037311b4a
--- /dev/null
+++ b/lib/public/Files/Events/Node/NodeTouchedEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class NodeTouchedEvent extends AbstractNodeEvent {
+}
diff --git a/lib/public/Files/Events/Node/NodeWrittenEvent.php b/lib/public/Files/Events/Node/NodeWrittenEvent.php
new file mode 100644
index 00000000000..b6bb949167c
--- /dev/null
+++ b/lib/public/Files/Events/Node/NodeWrittenEvent.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events\Node;
+
+/**
+ * @since 20.0.0
+ */
+class NodeWrittenEvent extends AbstractNodeEvent {
+}
diff --git a/lib/public/Files/Events/NodeAddedToCache.php b/lib/public/Files/Events/NodeAddedToCache.php
new file mode 100644
index 00000000000..4ea20a3f3c1
--- /dev/null
+++ b/lib/public/Files/Events/NodeAddedToCache.php
@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\Files\Storage\IStorage;
+
+/**
+ * @since 18.0.0
+ */
+class NodeAddedToCache extends Event {
+ /** @var IStorage */
+ private $storage;
+
+ /** @var string */
+ private $path;
+
+ /**
+ * @param IStorage $storage
+ * @param string $path
+ * @since 18.0.0
+ */
+ public function __construct(IStorage $storage,
+ string $path) {
+ parent::__construct();
+ $this->storage = $storage;
+ $this->path = $path;
+ }
+
+ /**
+ * @return IStorage
+ * @since 18.0.0
+ */
+ public function getStorage(): IStorage {
+ return $this->storage;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getPath(): string {
+ return $this->path;
+ }
+}
diff --git a/lib/public/Files/Events/NodeAddedToFavorite.php b/lib/public/Files/Events/NodeAddedToFavorite.php
new file mode 100644
index 00000000000..2a2725063b6
--- /dev/null
+++ b/lib/public/Files/Events/NodeAddedToFavorite.php
@@ -0,0 +1,49 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 28.0.0
+ */
+class NodeAddedToFavorite extends Event {
+ /**
+ * @since 28.0.0
+ */
+ public function __construct(
+ protected IUser $user,
+ protected int $fileId,
+ protected string $path,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getFileId(): int {
+ return $this->fileId;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getPath(): string {
+ return $this->path;
+ }
+}
diff --git a/lib/public/Files/Events/NodeRemovedFromCache.php b/lib/public/Files/Events/NodeRemovedFromCache.php
new file mode 100644
index 00000000000..01c8c21f71d
--- /dev/null
+++ b/lib/public/Files/Events/NodeRemovedFromCache.php
@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\Files\Storage\IStorage;
+
+/**
+ * @since 18.0.0
+ */
+class NodeRemovedFromCache extends Event {
+ /** @var IStorage */
+ private $storage;
+
+ /** @var string */
+ private $path;
+
+ /**
+ * @param IStorage $storage
+ * @param string $path
+ * @since 18.0.0
+ */
+ public function __construct(IStorage $storage,
+ string $path) {
+ parent::__construct();
+ $this->storage = $storage;
+ $this->path = $path;
+ }
+
+ /**
+ * @return IStorage
+ * @since 18.0.0
+ */
+ public function getStorage(): IStorage {
+ return $this->storage;
+ }
+
+ /**
+ * @return string
+ * @since 18.0.0
+ */
+ public function getPath(): string {
+ return $this->path;
+ }
+}
diff --git a/lib/public/Files/Events/NodeRemovedFromFavorite.php b/lib/public/Files/Events/NodeRemovedFromFavorite.php
new file mode 100644
index 00000000000..3b2f75346c4
--- /dev/null
+++ b/lib/public/Files/Events/NodeRemovedFromFavorite.php
@@ -0,0 +1,49 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Files\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\IUser;
+
+/**
+ * @since 28.0.0
+ */
+class NodeRemovedFromFavorite extends Event {
+ /**
+ * @since 28.0.0
+ */
+ public function __construct(
+ protected IUser $user,
+ protected int $fileId,
+ protected string $path,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getUser(): IUser {
+ return $this->user;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getFileId(): int {
+ return $this->fileId;
+ }
+
+ /**
+ * @since 28.0.0
+ */
+ public function getPath(): string {
+ return $this->path;
+ }
+}