From 52ba75f6442ad326f5113cd3e89c4024118c4fcf Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 9 Mar 2020 16:32:04 +0100 Subject: [PATCH] Sabre/DAV 4.0: beforeMethod is now beforeMethod:* Signed-off-by: Georg Ehrke --- .../lib/CalDAV/InvitationResponse/InvitationResponseServer.php | 2 +- apps/dav/lib/CalDAV/WebcalCaching/Plugin.php | 2 +- apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php | 2 +- apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php | 2 +- apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php | 2 +- apps/dav/lib/Connector/Sabre/LockPlugin.php | 2 +- apps/dav/lib/Connector/Sabre/MaintenancePlugin.php | 2 +- apps/dav/lib/Connector/Sabre/ServerFactory.php | 2 +- apps/dav/lib/Files/Sharing/FilesDropPlugin.php | 2 +- apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php | 2 +- apps/dav/lib/Server.php | 2 +- apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php | 2 +- remote.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php index 0702d8fc9a..e285bbc378 100644 --- a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php +++ b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php @@ -94,7 +94,7 @@ class InvitationResponseServer { )); // wait with registering these until auth is handled and the filesystem is setup - $this->server->on('beforeMethod', function () use ($root) { + $this->server->on('beforeMethod:*', function () use ($root) { // register plugins from apps $pluginManager = new PluginManager( \OC::$server, diff --git a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php index cea11de395..783c73968b 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/Plugin.php @@ -83,7 +83,7 @@ class Plugin extends ServerPlugin { */ public function initialize(Server $server) { $this->server = $server; - $server->on('beforeMethod', [$this, 'beforeMethod']); + $server->on('beforeMethod:*', [$this, 'beforeMethod']); } /** diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php index de414e3aa2..79999f968a 100644 --- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php @@ -46,7 +46,7 @@ class AnonymousOptionsPlugin extends ServerPlugin { public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; // before auth - $this->server->on('beforeMethod', [$this, 'handleAnonymousOptions'], 9); + $this->server->on('beforeMethod:*', [$this, 'handleAnonymousOptions'], 9); } /** diff --git a/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php b/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php index 947b2960ea..896a6a5518 100644 --- a/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php +++ b/apps/dav/lib/Connector/Sabre/AppEnabledPlugin.php @@ -74,7 +74,7 @@ class AppEnabledPlugin extends ServerPlugin { public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; - $this->server->on('beforeMethod', [$this, 'checkAppEnabled'], 30); + $this->server->on('beforeMethod:*', [$this, 'checkAppEnabled'], 30); } /** diff --git a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php index 6d7a635f1d..07c7aad0d1 100644 --- a/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php +++ b/apps/dav/lib/Connector/Sabre/BlockLegacyClientPlugin.php @@ -53,7 +53,7 @@ class BlockLegacyClientPlugin extends ServerPlugin { */ public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; - $this->server->on('beforeMethod', [$this, 'beforeHandler'], 200); + $this->server->on('beforeMethod:*', [$this, 'beforeHandler'], 200); } /** diff --git a/apps/dav/lib/Connector/Sabre/LockPlugin.php b/apps/dav/lib/Connector/Sabre/LockPlugin.php index 0d5cad6d9a..077086c40d 100644 --- a/apps/dav/lib/Connector/Sabre/LockPlugin.php +++ b/apps/dav/lib/Connector/Sabre/LockPlugin.php @@ -45,7 +45,7 @@ class LockPlugin extends ServerPlugin { */ public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; - $this->server->on('beforeMethod', [$this, 'getLock'], 50); + $this->server->on('beforeMethod:*', [$this, 'getLock'], 50); $this->server->on('afterMethod', [$this, 'releaseLock'], 50); } diff --git a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php index 4076abe59f..67e57e788b 100644 --- a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php +++ b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php @@ -67,7 +67,7 @@ class MaintenancePlugin extends ServerPlugin { */ public function initialize(\Sabre\DAV\Server $server) { $this->server = $server; - $this->server->on('beforeMethod', [$this, 'checkMaintenanceMode'], 1); + $this->server->on('beforeMethod:*', [$this, 'checkMaintenanceMode'], 1); } /** diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php index 9efd9ba7b5..d26e19c67c 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -140,7 +140,7 @@ class ServerFactory { } // wait with registering these until auth is handled and the filesystem is setup - $server->on('beforeMethod', function () use ($server, $objectTree, $viewCallBack) { + $server->on('beforeMethod:*', function () use ($server, $objectTree, $viewCallBack) { // ensure the skeleton is copied $userFolder = \OC::$server->getUserFolder(); diff --git a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php index 7a34ef9507..4542d0b52d 100644 --- a/apps/dav/lib/Files/Sharing/FilesDropPlugin.php +++ b/apps/dav/lib/Files/Sharing/FilesDropPlugin.php @@ -61,7 +61,7 @@ class FilesDropPlugin extends ServerPlugin { * @throws MethodNotAllowed */ public function initialize(\Sabre\DAV\Server $server) { - $server->on('beforeMethod', [$this, 'beforeMethod'], 999); + $server->on('beforeMethod:*', [$this, 'beforeMethod'], 999); $this->enabled = false; } diff --git a/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php b/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php index 84401196b1..4c45a29902 100644 --- a/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php +++ b/apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php @@ -52,7 +52,7 @@ class PublicLinkCheckPlugin extends ServerPlugin { * @return void */ public function initialize(\Sabre\DAV\Server $server) { - $server->on('beforeMethod', [$this, 'beforeMethod']); + $server->on('beforeMethod:*', [$this, 'beforeMethod']); } public function beforeMethod(RequestInterface $request, ResponseInterface $response){ diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index 2502d53997..230e72fd27 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -217,7 +217,7 @@ class Server { $this->server->addPlugin(new SearchPlugin($lazySearchBackend)); // wait with registering these until auth is handled and the filesystem is setup - $this->server->on('beforeMethod', function () use ($root, $lazySearchBackend) { + $this->server->on('beforeMethod:*', function () use ($root, $lazySearchBackend) { // custom properties plugin must be the last one $userSession = \OC::$server->getUserSession(); $user = $userSession->getUser(); diff --git a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php index 77646b2c9d..82a4515c7e 100644 --- a/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php +++ b/apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php @@ -66,7 +66,7 @@ class FilesDropPluginTest extends TestCase { $this->server->expects($this->once()) ->method('on') ->with( - $this->equalTo('beforeMethod'), + $this->equalTo('beforeMethod:*'), $this->equalTo([$this->plugin, 'beforeMethod']), $this->equalTo(999) ); diff --git a/remote.php b/remote.php index 7d20b4fbdf..b1777e92f7 100644 --- a/remote.php +++ b/remote.php @@ -58,7 +58,7 @@ function handleException($e) { // we shall not log on RemoteException $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger())); } - $server->on('beforeMethod', function () use ($e) { + $server->on('beforeMethod:*', function () use ($e) { if ($e instanceof RemoteException) { switch ($e->getCode()) { case 503: