Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OCA\AppAPI\Notifications\ExAppNotifier;
use OCA\AppAPI\PublicCapabilities;
use OCA\AppAPI\SetupChecks\DaemonCheck;
use OCA\DAV\Events\SabrePluginAddEvent;
use OCA\DAV\Events\SabrePluginAuthInitEvent;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCP\AppFramework\App;
Expand All @@ -32,7 +33,6 @@
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Navigation\Events\LoadAdditionalEntriesEvent;
use OCP\SabrePluginEvent;
use OCP\Settings\Events\DeclarativeSettingsGetValueEvent;
use OCP\Settings\Events\DeclarativeSettingsRegisterFormEvent;
use OCP\Settings\Events\DeclarativeSettingsSetValueEvent;
Expand Down Expand Up @@ -77,9 +77,9 @@ public function boot(IBootContext $context): void {
public function registerDavAuth(): void {
$container = $this->getContainer();

$dispatcher = $container->query(IEventDispatcher::class);
$dispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', function (SabrePluginEvent $event) use ($container) {
$event->getServer()->addPlugin($container->query(DavPlugin::class));
$dispatcher = $container->get(IEventDispatcher::class);
$dispatcher->addListener(SabrePluginAddEvent::class, function (SabrePluginAddEvent $event) use ($container) {
$event->getServer()->addPlugin($container->get(DavPlugin::class));
});
}
}
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@
</errorLevel>
</UndefinedDocblockClass>
</issueHandlers>
<stubs>
<file name="tests/stubs/oca_dav_events_sabrepluginaddevent.php"/>
</stubs>
</psalm>
35 changes: 35 additions & 0 deletions tests/stubs/oca_dav_events_sabrepluginaddevent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Events;

use OCP\EventDispatcher\Event;
use Sabre\DAV\Server;

/**
* This event is triggered during the setup of the SabreDAV server to allow the
* registration of additional plugins.
*
* @since 28.0.0
*/
class SabrePluginAddEvent extends Event {

/**
* @since 28.0.0
*/
public function __construct(
private Server $server,
) {
}

/**
* @since 28.0.0
*/
public function getServer(): Server {
}
}
Loading