mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
manual backport of #35789, dispatch BeforeSabrePubliclyLoadedEvent to allow adding additional Sabre plugins in publicwebdav.php
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
parent
6aae233f56
commit
abf8b774ff
4 changed files with 40 additions and 0 deletions
|
|
@ -30,6 +30,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use OCP\BeforeSabrePubliclyLoadedEvent;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
// load needed apps
|
||||
|
|
@ -112,6 +114,11 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct
|
|||
|
||||
$server->addPlugin($linkCheckPlugin);
|
||||
$server->addPlugin($filesDropPlugin);
|
||||
// allow setup of additional plugins
|
||||
$event = new BeforeSabrePubliclyLoadedEvent($server);
|
||||
/** @var IEventDispatcher $eventDispatcher */
|
||||
$eventDispatcher = \OC::$server->get(IEventDispatcher::class);
|
||||
$eventDispatcher->dispatchTyped($event);
|
||||
|
||||
// And off we go!
|
||||
$server->exec();
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ return array(
|
|||
'OCP\\BackgroundJob\\Job' => $baseDir . '/lib/public/BackgroundJob/Job.php',
|
||||
'OCP\\BackgroundJob\\QueuedJob' => $baseDir . '/lib/public/BackgroundJob/QueuedJob.php',
|
||||
'OCP\\BackgroundJob\\TimedJob' => $baseDir . '/lib/public/BackgroundJob/TimedJob.php',
|
||||
'OCP\\BeforeSabrePubliclyLoadedEvent' => $baseDir . '/lib/public/BeforeSabrePubliclyLoadedEvent.php',
|
||||
'OCP\\Broadcast\\Events\\IBroadcastEvent' => $baseDir . '/lib/public/Broadcast/Events/IBroadcastEvent.php',
|
||||
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => $baseDir . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
|
||||
'OCP\\Calendar\\Exceptions\\CalendarException' => $baseDir . '/lib/public/Calendar/Exceptions/CalendarException.php',
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
|
|||
'OCP\\BackgroundJob\\Job' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/Job.php',
|
||||
'OCP\\BackgroundJob\\QueuedJob' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/QueuedJob.php',
|
||||
'OCP\\BackgroundJob\\TimedJob' => __DIR__ . '/../../..' . '/lib/public/BackgroundJob/TimedJob.php',
|
||||
'OCP\\BeforeSabrePubliclyLoadedEvent' => __DIR__ . '/../../..' . '/lib/public/BeforeSabrePubliclyLoadedEvent.php',
|
||||
'OCP\\Broadcast\\Events\\IBroadcastEvent' => __DIR__ . '/../../..' . '/lib/public/Broadcast/Events/IBroadcastEvent.php',
|
||||
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => __DIR__ . '/../../..' . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
|
||||
'OCP\\Calendar\\Exceptions\\CalendarException' => __DIR__ . '/../../..' . '/lib/public/Calendar/Exceptions/CalendarException.php',
|
||||
|
|
|
|||
31
lib/public/BeforeSabrePubliclyLoadedEvent.php
Normal file
31
lib/public/BeforeSabrePubliclyLoadedEvent.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Julien Veyssier <eneiluj@posteo.net> 2022
|
||||
*
|
||||
* @author Julien Veyssier <eneiluj@posteo.net>
|
||||
*
|
||||
* @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 <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace OCP;
|
||||
|
||||
/**
|
||||
* Dispatched before Sabre is loaded when accessing public webdav endpoints
|
||||
* This can be used to inject a Sabre plugin for example
|
||||
*
|
||||
* @since 24.0.0
|
||||
*/
|
||||
class BeforeSabrePubliclyLoadedEvent extends SabrePluginEvent {
|
||||
}
|
||||
Loading…
Reference in a new issue