diff --git a/apps/dav/lib/Connector/Sabre/Server.php b/apps/dav/lib/Connector/Sabre/Server.php index 477f9b93a4dce..c6e55c79af25b 100644 --- a/apps/dav/lib/Connector/Sabre/Server.php +++ b/apps/dav/lib/Connector/Sabre/Server.php @@ -150,12 +150,13 @@ private function getMonitoredCallback( string $pluginName, string $eventName, ): callable { + $connection = \OCP\Server::get(Connection::class); return function (PropFind $propFind, INode $node) use ( $callBack, $pluginName, $eventName, + $connection, ): bool { - $connection = \OCP\Server::get(Connection::class); $queriesBefore = $connection->getStats()['executed']; $result = $callBack($propFind, $node); $queriesAfter = $connection->getStats()['executed'];