aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Files/Events
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-12-11 11:27:05 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-12-13 09:41:05 +0100
commitb81b824da138281d904c775664c82f060ba4fbec (patch)
tree0194aea2aabe08a168bc32ccf964b94f31db6ae5 /lib/public/Files/Events
parent642606754b133a36d7715b45b243155cbb006f95 (diff)
downloadnextcloud-server-b81b824da138281d904c775664c82f060ba4fbec.tar.gz
nextcloud-server-b81b824da138281d904c775664c82f060ba4fbec.zip
Add typed events for the filesystem/scanner
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public/Files/Events')
-rw-r--r--lib/public/Files/Events/BeforeFileScannedEvent.php56
-rw-r--r--lib/public/Files/Events/BeforeFolderScannedEvent.php56
-rw-r--r--lib/public/Files/Events/FileCacheUpdated.php70
-rw-r--r--lib/public/Files/Events/FileScannedEvent.php56
-rw-r--r--lib/public/Files/Events/FolderScannedEvent.php56
-rw-r--r--lib/public/Files/Events/NodeAddedToCache.php70
-rw-r--r--lib/public/Files/Events/NodeRemovedFromCache.php70
7 files changed, 434 insertions, 0 deletions
diff --git a/lib/public/Files/Events/BeforeFileScannedEvent.php b/lib/public/Files/Events/BeforeFileScannedEvent.php
new file mode 100644
index 00000000000..3f8dca2b333
--- /dev/null
+++ b/lib/public/Files/Events/BeforeFileScannedEvent.php
@@ -0,0 +1,56 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+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/BeforeFolderScannedEvent.php b/lib/public/Files/Events/BeforeFolderScannedEvent.php
new file mode 100644
index 00000000000..a253974c21e
--- /dev/null
+++ b/lib/public/Files/Events/BeforeFolderScannedEvent.php
@@ -0,0 +1,56 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+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/FileCacheUpdated.php b/lib/public/Files/Events/FileCacheUpdated.php
new file mode 100644
index 00000000000..c0f4771ae52
--- /dev/null
+++ b/lib/public/Files/Events/FileCacheUpdated.php
@@ -0,0 +1,70 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+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..a93189225e4
--- /dev/null
+++ b/lib/public/Files/Events/FileScannedEvent.php
@@ -0,0 +1,56 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+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..d1667cd8bc6
--- /dev/null
+++ b/lib/public/Files/Events/FolderScannedEvent.php
@@ -0,0 +1,56 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+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/NodeAddedToCache.php b/lib/public/Files/Events/NodeAddedToCache.php
new file mode 100644
index 00000000000..966d42a384e
--- /dev/null
+++ b/lib/public/Files/Events/NodeAddedToCache.php
@@ -0,0 +1,70 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+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/NodeRemovedFromCache.php b/lib/public/Files/Events/NodeRemovedFromCache.php
new file mode 100644
index 00000000000..c8d84624a8b
--- /dev/null
+++ b/lib/public/Files/Events/NodeRemovedFromCache.php
@@ -0,0 +1,70 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+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;
+ }
+
+}