Skip to content

Commit 48adb59

Browse files
committed
manual backport of #35789, dispatch BeforeSabrePubliclyLoadedEvent to allow adding additional Sabre plugins in publicwebdav.php
Signed-off-by: Julien Veyssier <[email protected]>
1 parent 1aa4a0e commit 48adb59

4 files changed

Lines changed: 40 additions & 0 deletions

File tree

apps/dav/appinfo/v1/publicwebdav.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
*
3131
*/
3232

33+
use OCP\BeforeSabrePubliclyLoadedEvent;
34+
use OCP\EventDispatcher\IEventDispatcher;
3335
use Psr\Log\LoggerInterface;
3436

3537
// load needed apps
@@ -111,6 +113,11 @@
111113

112114
$server->addPlugin($linkCheckPlugin);
113115
$server->addPlugin($filesDropPlugin);
116+
// allow setup of additional plugins
117+
$event = new BeforeSabrePubliclyLoadedEvent($server);
118+
/** @var IEventDispatcher $eventDispatcher */
119+
$eventDispatcher = \OC::$server->get(IEventDispatcher::class);
120+
$eventDispatcher->dispatchTyped($event);
114121

115122
// And off we go!
116123
$server->exec();

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
'OCP\\BackgroundJob\\Job' => $baseDir . '/lib/public/BackgroundJob/Job.php',
115115
'OCP\\BackgroundJob\\QueuedJob' => $baseDir . '/lib/public/BackgroundJob/QueuedJob.php',
116116
'OCP\\BackgroundJob\\TimedJob' => $baseDir . '/lib/public/BackgroundJob/TimedJob.php',
117+
'OCP\\BeforeSabrePubliclyLoadedEvent' => $baseDir . '/lib/public/BeforeSabrePubliclyLoadedEvent.php',
117118
'OCP\\Broadcast\\Events\\IBroadcastEvent' => $baseDir . '/lib/public/Broadcast/Events/IBroadcastEvent.php',
118119
'OCP\\Cache\\CappedMemoryCache' => $baseDir . '/lib/public/Cache/CappedMemoryCache.php',
119120
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => $baseDir . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
147147
'OCP\\BackgroundJob\\Job' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/Job.php',
148148
'OCP\\BackgroundJob\\QueuedJob' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/QueuedJob.php',
149149
'OCP\\BackgroundJob\\TimedJob' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/TimedJob.php',
150+
'OCP\\BeforeSabrePubliclyLoadedEvent' => __DIR__ . '/../../..' . '/lib/public/BeforeSabrePubliclyLoadedEvent.php',
150151
'OCP\\Broadcast\\Events\\IBroadcastEvent' => __DIR__ . '/../../..' . '/lib/public/Broadcast/Events/IBroadcastEvent.php',
151152
'OCP\\Cache\\CappedMemoryCache' => __DIR__ . '/../../..' . '/lib/public/Cache/CappedMemoryCache.php',
152153
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => __DIR__ . '/../../..' . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* @copyright Julien Veyssier <[email protected]> 2022
4+
*
5+
* @author Julien Veyssier <[email protected]>
6+
*
7+
* @license AGPL-3.0-or-later
8+
*
9+
* This code is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Affero General Public License, version 3,
11+
* as published by the Free Software Foundation.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License, version 3,
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>
20+
*
21+
*/
22+
namespace OCP;
23+
24+
/**
25+
* Dispatched before Sabre is loaded when accessing public webdav endpoints
26+
* This can be used to inject a Sabre plugin for example
27+
*
28+
* @since 25.0.0
29+
*/
30+
class BeforeSabrePubliclyLoadedEvent extends SabrePluginEvent {
31+
}

0 commit comments

Comments
 (0)