Sabre/DAV 4.0: beforeMethod is now beforeMethod:*

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2020-03-09 16:32:04 +01:00 committed by Roeland Jago Douma
parent 8648ee131a
commit 52ba75f644
No known key found for this signature in database
GPG Key ID: F941078878347C0C
13 changed files with 13 additions and 13 deletions

View File

@ -94,7 +94,7 @@ class InvitationResponseServer {
)); ));
// wait with registering these until auth is handled and the filesystem is setup // 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 // register plugins from apps
$pluginManager = new PluginManager( $pluginManager = new PluginManager(
\OC::$server, \OC::$server,

View File

@ -83,7 +83,7 @@ class Plugin extends ServerPlugin {
*/ */
public function initialize(Server $server) { public function initialize(Server $server) {
$this->server = $server; $this->server = $server;
$server->on('beforeMethod', [$this, 'beforeMethod']); $server->on('beforeMethod:*', [$this, 'beforeMethod']);
} }
/** /**

View File

@ -46,7 +46,7 @@ class AnonymousOptionsPlugin extends ServerPlugin {
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$this->server = $server; $this->server = $server;
// before auth // before auth
$this->server->on('beforeMethod', [$this, 'handleAnonymousOptions'], 9); $this->server->on('beforeMethod:*', [$this, 'handleAnonymousOptions'], 9);
} }
/** /**

View File

@ -74,7 +74,7 @@ class AppEnabledPlugin extends ServerPlugin {
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$this->server = $server; $this->server = $server;
$this->server->on('beforeMethod', [$this, 'checkAppEnabled'], 30); $this->server->on('beforeMethod:*', [$this, 'checkAppEnabled'], 30);
} }
/** /**

View File

@ -53,7 +53,7 @@ class BlockLegacyClientPlugin extends ServerPlugin {
*/ */
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$this->server = $server; $this->server = $server;
$this->server->on('beforeMethod', [$this, 'beforeHandler'], 200); $this->server->on('beforeMethod:*', [$this, 'beforeHandler'], 200);
} }
/** /**

View File

@ -45,7 +45,7 @@ class LockPlugin extends ServerPlugin {
*/ */
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$this->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); $this->server->on('afterMethod', [$this, 'releaseLock'], 50);
} }

View File

@ -67,7 +67,7 @@ class MaintenancePlugin extends ServerPlugin {
*/ */
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$this->server = $server; $this->server = $server;
$this->server->on('beforeMethod', [$this, 'checkMaintenanceMode'], 1); $this->server->on('beforeMethod:*', [$this, 'checkMaintenanceMode'], 1);
} }
/** /**

View File

@ -140,7 +140,7 @@ class ServerFactory {
} }
// wait with registering these until auth is handled and the filesystem is setup // 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 // ensure the skeleton is copied
$userFolder = \OC::$server->getUserFolder(); $userFolder = \OC::$server->getUserFolder();

View File

@ -61,7 +61,7 @@ class FilesDropPlugin extends ServerPlugin {
* @throws MethodNotAllowed * @throws MethodNotAllowed
*/ */
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$server->on('beforeMethod', [$this, 'beforeMethod'], 999); $server->on('beforeMethod:*', [$this, 'beforeMethod'], 999);
$this->enabled = false; $this->enabled = false;
} }

View File

@ -52,7 +52,7 @@ class PublicLinkCheckPlugin extends ServerPlugin {
* @return void * @return void
*/ */
public function initialize(\Sabre\DAV\Server $server) { public function initialize(\Sabre\DAV\Server $server) {
$server->on('beforeMethod', [$this, 'beforeMethod']); $server->on('beforeMethod:*', [$this, 'beforeMethod']);
} }
public function beforeMethod(RequestInterface $request, ResponseInterface $response){ public function beforeMethod(RequestInterface $request, ResponseInterface $response){

View File

@ -217,7 +217,7 @@ class Server {
$this->server->addPlugin(new SearchPlugin($lazySearchBackend)); $this->server->addPlugin(new SearchPlugin($lazySearchBackend));
// wait with registering these until auth is handled and the filesystem is setup // 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 // custom properties plugin must be the last one
$userSession = \OC::$server->getUserSession(); $userSession = \OC::$server->getUserSession();
$user = $userSession->getUser(); $user = $userSession->getUser();

View File

@ -66,7 +66,7 @@ class FilesDropPluginTest extends TestCase {
$this->server->expects($this->once()) $this->server->expects($this->once())
->method('on') ->method('on')
->with( ->with(
$this->equalTo('beforeMethod'), $this->equalTo('beforeMethod:*'),
$this->equalTo([$this->plugin, 'beforeMethod']), $this->equalTo([$this->plugin, 'beforeMethod']),
$this->equalTo(999) $this->equalTo(999)
); );

View File

@ -58,7 +58,7 @@ function handleException($e) {
// we shall not log on RemoteException // we shall not log on RemoteException
$server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger())); $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
} }
$server->on('beforeMethod', function () use ($e) { $server->on('beforeMethod:*', function () use ($e) {
if ($e instanceof RemoteException) { if ($e instanceof RemoteException) {
switch ($e->getCode()) { switch ($e->getCode()) {
case 503: case 503: