From f2085ad7cc67320960c3750f97e19c0813f43c9d Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Tue, 6 Dec 2022 14:03:36 +0100 Subject: [PATCH 1/2] allow additional Sabre plugins in publicwebdav.php Signed-off-by: Julien Veyssier --- apps/dav/appinfo/v1/publicwebdav.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/dav/appinfo/v1/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php index c99c5bcd83399..dce74bce79f70 100644 --- a/apps/dav/appinfo/v1/publicwebdav.php +++ b/apps/dav/appinfo/v1/publicwebdav.php @@ -108,6 +108,9 @@ $server->addPlugin($linkCheckPlugin); $server->addPlugin($filesDropPlugin); +// allow setup of additional plugins +$event = new \OCP\SabrePluginEvent($server); +\OC::$server->getEventDispatcher()->dispatch('OCA\DAV\Connector\Sabre::addPublicPlugin', $event); // And off we go! $server->exec(); From 90e213937ee49a9f69beac36bd9944babe555002 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Tue, 6 Dec 2022 17:22:53 +0100 Subject: [PATCH 2/2] use modern event dispatch Signed-off-by: Julien Veyssier --- apps/dav/appinfo/v1/publicwebdav.php | 6 ++++-- lib/public/SabrePublicPluginEvent.php | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 lib/public/SabrePublicPluginEvent.php diff --git a/apps/dav/appinfo/v1/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php index dce74bce79f70..57e7f6b10e43a 100644 --- a/apps/dav/appinfo/v1/publicwebdav.php +++ b/apps/dav/appinfo/v1/publicwebdav.php @@ -109,8 +109,10 @@ $server->addPlugin($linkCheckPlugin); $server->addPlugin($filesDropPlugin); // allow setup of additional plugins -$event = new \OCP\SabrePluginEvent($server); -\OC::$server->getEventDispatcher()->dispatch('OCA\DAV\Connector\Sabre::addPublicPlugin', $event); +$event = new SabrePublicPluginEvent($server); +/** @var IEventDispatcher $eventDispatcher */ +$eventDispatcher = \OC::$server->get(IEventDispatcher::class); +$eventDispatcher->dispatchTyped($event); // And off we go! $server->exec(); diff --git a/lib/public/SabrePublicPluginEvent.php b/lib/public/SabrePublicPluginEvent.php new file mode 100644 index 0000000000000..5c288c82b9426 --- /dev/null +++ b/lib/public/SabrePublicPluginEvent.php @@ -0,0 +1,25 @@ + 2022 + * + * @author Julien Veyssier + * + * @license AGPL-3.0-or-later + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see + * + */ +namespace OCP; + +class SabrePublicPluginEvent extends SabrePluginEvent { +}