Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-03-31 16:34:57 +0300
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-05-02 11:52:43 +0300
commite2531f8503dea904dd1cb389ca017ce7bda5ccfc (patch)
tree683918ba234959dd76e771aaae2af434b21d09fe /apps/dav/lib
parent49b650c4a46c76121d74c6c37c0dbfa0d8f53dbe (diff)
Migrate dav application from ILogger to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/AppInfo/Application.php10
-rw-r--r--apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php15
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php25
-rw-r--r--apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php9
-rw-r--r--apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php13
-rw-r--r--apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php13
-rw-r--r--apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php12
-rw-r--r--apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php16
-rw-r--r--apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php10
-rw-r--r--apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php10
-rw-r--r--apps/dav/lib/CalDAV/Schedule/IMipPlugin.php22
-rw-r--r--apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php34
-rw-r--r--apps/dav/lib/CardDAV/PhotoCache.php18
-rw-r--r--apps/dav/lib/CardDAV/SyncService.php15
-rw-r--r--apps/dav/lib/Comments/CommentNode.php17
-rw-r--r--apps/dav/lib/Comments/EntityCollection.php9
-rw-r--r--apps/dav/lib/Comments/EntityTypeCollection.php9
-rw-r--r--apps/dav/lib/Comments/RootCollection.php14
-rw-r--r--apps/dav/lib/Connector/Sabre/Auth.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php25
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php15
-rw-r--r--apps/dav/lib/Connector/Sabre/ServerFactory.php17
-rw-r--r--apps/dav/lib/HookManager.php8
-rw-r--r--apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php12
-rw-r--r--apps/dav/lib/RootCollection.php13
-rw-r--r--apps/dav/lib/Server.php21
26 files changed, 128 insertions, 257 deletions
diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php
index 8c7f21698a1..580918a6450 100644
--- a/apps/dav/lib/AppInfo/Application.php
+++ b/apps/dav/lib/AppInfo/Application.php
@@ -89,10 +89,10 @@ use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\IAppContainer;
use OCP\Calendar\IManager as ICalendarManager;
use OCP\Contacts\IManager as IContactsManager;
-use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IUser;
use Psr\Container\ContainerInterface;
+use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Throwable;
@@ -113,7 +113,7 @@ class Application extends App implements IBootstrap {
return new PhotoCache(
$server->getAppDataDir('dav-photocache'),
- $c->get(ILogger::class)
+ $c->get(LoggerInterface::class)
);
});
@@ -325,7 +325,7 @@ class Application extends App implements IBootstrap {
$job->run([]);
$serverContainer->getJobList()->setLastRun($job);
} catch (Exception $ex) {
- $serverContainer->getLogger()->logException($ex);
+ $serverContainer->get(LoggerInterface::class)->error($ex->getMessage(), ['exception' => $ex]);
}
};
@@ -379,13 +379,13 @@ class Application extends App implements IBootstrap {
}
public function registerCalendarReminders(NotificationProviderManager $manager,
- ILogger $logger): void {
+ LoggerInterface $logger): void {
try {
$manager->registerProvider(AudioProvider::class);
$manager->registerProvider(EmailProvider::class);
$manager->registerProvider(PushProvider::class);
} catch (Throwable $ex) {
- $logger->logException($ex);
+ $logger->error($ex->getMessage(), ['exception' => $ex]);
}
}
}
diff --git a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php
index 3d4e4dd5e6b..7f1e78248d3 100644
--- a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php
+++ b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php
@@ -32,7 +32,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\QueuedJob;
use OCP\IDBConnection;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
/**
* Class BuildReminderIndexBackgroundJob
@@ -47,8 +47,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
/** @var ReminderService */
private $reminderService;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var IJobList */
private $jobList;
@@ -58,16 +57,10 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
/**
* BuildReminderIndexBackgroundJob constructor.
- *
- * @param IDBConnection $db
- * @param ReminderService $reminderService
- * @param ILogger $logger
- * @param IJobList $jobList
- * @param ITimeFactory $timeFactory
*/
public function __construct(IDBConnection $db,
ReminderService $reminderService,
- ILogger $logger,
+ LoggerInterface $logger,
IJobList $jobList,
ITimeFactory $timeFactory) {
parent::__construct($timeFactory);
@@ -126,7 +119,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
try {
$this->reminderService->onCalendarObjectCreate($row);
} catch (\Exception $ex) {
- $this->logger->logException($ex);
+ $this->logger->error($ex->getMessage(), ['exception' => $ex]);
}
if (($this->timeFactory->getTime() - $startTime) > 15) {
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index f0d332adab5..3253d41a5cd 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -69,10 +69,10 @@ use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
-use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Security\ISecureRandom;
+use Psr\Log\LoggerInterface;
use RuntimeException;
use Sabre\CalDAV\Backend\AbstractBackend;
use Sabre\CalDAV\Backend\SchedulingSupport;
@@ -220,8 +220,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
/** @var ISecureRandom */
private $random;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var IEventDispatcher */
private $dispatcher;
@@ -240,23 +239,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
/**
* CalDavBackend constructor.
- *
- * @param IDBConnection $db
- * @param Principal $principalBackend
- * @param IUserManager $userManager
- * @param IGroupManager $groupManager
- * @param ISecureRandom $random
- * @param ILogger $logger
- * @param IEventDispatcher $dispatcher
- * @param EventDispatcherInterface $legacyDispatcher
- * @param bool $legacyEndpoint
*/
public function __construct(IDBConnection $db,
Principal $principalBackend,
IUserManager $userManager,
IGroupManager $groupManager,
ISecureRandom $random,
- ILogger $logger,
+ LoggerInterface $logger,
IEventDispatcher $dispatcher,
EventDispatcherInterface $legacyDispatcher,
IConfig $config,
@@ -1715,15 +1704,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
try {
$matches = $this->validateFilterForObject($row, $filters);
} catch (ParseException $ex) {
- $this->logger->logException($ex, [
+ $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [
'app' => 'dav',
- 'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri']
+ 'exception' => $ex,
]);
continue;
} catch (InvalidDataException $ex) {
- $this->logger->logException($ex, [
+ $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [
'app' => 'dav',
- 'message' => 'Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri']
+ 'exception' => $ex,
]);
continue;
}
diff --git a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php
index ae568720c55..0c76e4f5e10 100644
--- a/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php
+++ b/apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php
@@ -23,7 +23,7 @@
namespace OCA\DAV\CalDAV\ICSExportPlugin;
use OCP\IConfig;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
use Sabre\HTTP\ResponseInterface;
use Sabre\VObject\DateTimeParser;
use Sabre\VObject\InvalidDataException;
@@ -39,18 +39,15 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin {
/** @var IConfig */
private $config;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var string */
private const DEFAULT_REFRESH_INTERVAL = 'PT4H';
/**
* ICSExportPlugin constructor.
- *
- * @param IConfig $config
*/
- public function __construct(IConfig $config, ILogger $logger) {
+ public function __construct(IConfig $config, LoggerInterface $logger) {
$this->config = $config;
$this->logger = $logger;
}
diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php
index 044e5fac4e2..49cf36f98ac 100644
--- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php
+++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/AbstractProvider.php
@@ -32,10 +32,10 @@ namespace OCA\DAV\CalDAV\Reminder\NotificationProvider;
use OCA\DAV\CalDAV\Reminder\INotificationProvider;
use OCP\IConfig;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\L10N\IFactory as L10NFactory;
+use Psr\Log\LoggerInterface;
use Sabre\VObject\Component\VEvent;
use Sabre\VObject\DateTimeParser;
use Sabre\VObject\Property;
@@ -50,8 +50,7 @@ abstract class AbstractProvider implements INotificationProvider {
/** @var string */
public const NOTIFICATION_TYPE = '';
- /** @var ILogger */
- protected $logger;
+ protected LoggerInterface $logger;
/** @var L10NFactory */
protected $l10nFactory;
@@ -68,13 +67,7 @@ abstract class AbstractProvider implements INotificationProvider {
/** @var IConfig */
protected $config;
- /**
- * @param ILogger $logger
- * @param L10NFactory $l10nFactory
- * @param IConfig $config
- * @param IUrlGenerator $urlGenerator
- */
- public function __construct(ILogger $logger,
+ public function __construct(LoggerInterface $logger,
L10NFactory $l10nFactory,
IURLGenerator $urlGenerator,
IConfig $config) {
diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
index 456b9f8b42d..7e0020b5f55 100644
--- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
+++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
@@ -34,11 +34,11 @@ namespace OCA\DAV\CalDAV\Reminder\NotificationProvider;
use DateTime;
use OCP\IConfig;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\L10N\IFactory as L10NFactory;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
+use Psr\Log\LoggerInterface;
use Sabre\VObject;
use Sabre\VObject\Component\VEvent;
use Sabre\VObject\Parameter;
@@ -57,16 +57,9 @@ class EmailProvider extends AbstractProvider {
/** @var IMailer */
private $mailer;
- /**
- * @param IConfig $config
- * @param IMailer $mailer
- * @param ILogger $logger
- * @param L10NFactory $l10nFactory
- * @param IUrlGenerator $urlGenerator
- */
public function __construct(IConfig $config,
IMailer $mailer,
- ILogger $logger,
+ LoggerInterface $logger,
L10NFactory $l10nFactory,
IURLGenerator $urlGenerator) {
parent::__construct($logger, $l10nFactory, $urlGenerator, $config);
@@ -133,7 +126,7 @@ class EmailProvider extends AbstractProvider {
$this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => implode(', ', $failed)]);
}
} catch (\Exception $ex) {
- $this->logger->logException($ex, ['app' => 'dav']);
+ $this->logger->error($ex->getMessage(), ['app' => 'dav', 'exception' => $ex]);
}
}
}
diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php
index fb123960df8..298297fdc38 100644
--- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php
+++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php
@@ -32,12 +32,12 @@ namespace OCA\DAV\CalDAV\Reminder\NotificationProvider;
use OCA\DAV\AppInfo\Application;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
-use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\L10N\IFactory as L10NFactory;
use OCP\Notification\IManager;
use OCP\Notification\INotification;
+use Psr\Log\LoggerInterface;
use Sabre\VObject\Component\VEvent;
use Sabre\VObject\Property;
@@ -57,17 +57,9 @@ class PushProvider extends AbstractProvider {
/** @var ITimeFactory */
private $timeFactory;
- /**
- * @param IConfig $config
- * @param IManager $manager
- * @param ILogger $logger
- * @param L10NFactory $l10nFactory
- * @param IUrlGenerator $urlGenerator
- * @param ITimeFactory $timeFactory
- */
public function __construct(IConfig $config,
IManager $manager,
- ILogger $logger,
+ LoggerInterface $logger,
L10NFactory $l10nFactory,
IURLGenerator $urlGenerator,
ITimeFactory $timeFactory) {
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
index aebb5a24f0e..6fd69b7e3df 100644
--- a/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
+++ b/apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php
@@ -33,8 +33,8 @@ use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\IGroupManager;
-use OCP\ILogger;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\PropPatch;
use Sabre\DAVACL\PrincipalBackend\BackendInterface;
use function array_intersect;
@@ -54,8 +54,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
/** @var IGroupManager */
private $groupManager;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var ProxyMapper */
private $proxyMapper;
@@ -75,19 +74,10 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
/** @var string */
private $cuType;
- /**
- * @param IDBConnection $dbConnection
- * @param IUserSession $userSession
- * @param IGroupManager $groupManager
- * @param ILogger $logger
- * @param string $principalPrefix
- * @param string $dbPrefix
- * @param string $cuType
- */
public function __construct(IDBConnection $dbConnection,
IUserSession $userSession,
IGroupManager $groupManager,
- ILogger $logger,
+ LoggerInterface $logger,
ProxyMapper $proxyMapper,
string $principalPrefix,
string $dbPrefix,
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php
index 65203e24da5..20fdadbca0c 100644
--- a/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php
+++ b/apps/dav/lib/CalDAV/ResourceBooking/ResourcePrincipalBackend.php
@@ -25,8 +25,8 @@ namespace OCA\DAV\CalDAV\ResourceBooking;
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
use OCP\IDBConnection;
use OCP\IGroupManager;
-use OCP\ILogger;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
/**
* Class ResourcePrincipalBackend
@@ -37,17 +37,11 @@ class ResourcePrincipalBackend extends AbstractPrincipalBackend {
/**
* ResourcePrincipalBackend constructor.
- *
- * @param IDBConnection $dbConnection
- * @param IUserSession $userSession
- * @param IGroupManager $groupManager
- * @param ILogger $logger
- * @param ProxyMapper $proxyMapper
*/
public function __construct(IDBConnection $dbConnection,
IUserSession $userSession,
IGroupManager $groupManager,
- ILogger $logger,
+ LoggerInterface $logger,
ProxyMapper $proxyMapper) {
parent::__construct($dbConnection, $userSession, $groupManager, $logger,
$proxyMapper, 'principals/calendar-resources', 'resource', 'RESOURCE');
diff --git a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php
index ca78ebd4bc4..931635d632f 100644
--- a/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php
+++ b/apps/dav/lib/CalDAV/ResourceBooking/RoomPrincipalBackend.php
@@ -25,8 +25,8 @@ namespace OCA\DAV\CalDAV\ResourceBooking;
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
use OCP\IDBConnection;
use OCP\IGroupManager;
-use OCP\ILogger;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
/**
* Class RoomPrincipalBackend
@@ -37,17 +37,11 @@ class RoomPrincipalBackend extends AbstractPrincipalBackend {
/**
* RoomPrincipalBackend constructor.
- *
- * @param IDBConnection $dbConnection
- * @param IUserSession $userSession
- * @param IGroupManager $groupManager
- * @param ILogger $logger
- * @param ProxyMapper $proxyMapper
*/
public function __construct(IDBConnection $dbConnection,
IUserSession $userSession,
IGroupManager $groupManager,
- ILogger $logger,
+ LoggerInterface $logger,
ProxyMapper $proxyMapper) {
parent::__construct($dbConnection, $userSession, $groupManager, $logger,
$proxyMapper, 'principals/calendar-rooms', 'room', 'ROOM');
diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
index 8aacc33bb46..2c7b06a4396 100644
--- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
@@ -39,7 +39,6 @@ use OCP\Defaults;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\L10N\IFactory as L10NFactory;
@@ -47,6 +46,7 @@ use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
use OCP\Security\ISecureRandom;
use OCP\Util;
+use Psr\Log\LoggerInterface;
use Sabre\CalDAV\Schedule\IMipPlugin as SabreIMipPlugin;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;
@@ -81,8 +81,7 @@ class IMipPlugin extends SabreIMipPlugin {
/** @var IMailer */
private $mailer;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var ITimeFactory */
private $timeFactory;
@@ -112,19 +111,8 @@ class IMipPlugin extends SabreIMipPlugin {
public const METHOD_CANCEL = 'cancel';
public const IMIP_INDENT = 15; // Enough for the length of all body bullet items, in all languages
- /**
- * @param IConfig $config
- * @param IMailer $mailer
- * @param ILogger $logger
- * @param ITimeFactory $timeFactory
- * @param L10NFactory $l10nFactory
- * @param IUrlGenerator $urlGenerator
- * @param Defaults $defaults
- * @param ISecureRandom $random
- * @param IDBConnection $db
- * @param string $userId
- */
- public function __construct(IConfig $config, IMailer $mailer, ILogger $logger,
+ public function __construct(IConfig $config, IMailer $mailer,
+ LoggerInterface $logger,
ITimeFactory $timeFactory, L10NFactory $l10nFactory,
IURLGenerator $urlGenerator, Defaults $defaults,
ISecureRandom $random, IDBConnection $db, IUserManager $userManager,
@@ -306,7 +294,7 @@ class IMipPlugin extends SabreIMipPlugin {
$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
}
} catch (\Exception $ex) {
- $this->logger->logException($ex, ['app' => 'dav']);
+ $this->logger->error($ex->getMessage(), ['app' => 'dav', 'exception' => $ex]);
$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
}
}
diff --git a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php
index 543d15e0179..49f66735345 100644
--- a/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php
+++ b/apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php
@@ -37,9 +37,9 @@ use OCA\DAV\CalDAV\CalDavBackend;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\LocalServerException;
use OCP\IConfig;
-use OCP\ILogger;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\PropPatch;
use Sabre\DAV\Xml\Property\Href;
@@ -64,8 +64,7 @@ class RefreshWebcalService {
/** @var IConfig */
private $config;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
public const REFRESH_RATE = '{http://apple.com/ns/ical/}refreshrate';
public const STRIP_ALARMS = '{http://calendarserver.org/ns/}subscribed-strip-alarms';
@@ -74,23 +73,17 @@ class RefreshWebcalService {
/**
* RefreshWebcalJob constructor.
- *
- * @param CalDavBackend $calDavBackend
- * @param IClientService $clientService
- * @param IConfig $config
- * @param ILogger $logger
*/
- public function __construct(CalDavBackend $calDavBackend, IClientService $clientService, IConfig $config, ILogger $logger) {
+ public function __construct(CalDavBackend $calDavBackend,
+ IClientService $clientService,
+ IConfig $config,
+ LoggerInterface $logger) {
$this->calDavBackend = $calDavBackend;
$this->clientService = $clientService;
$this->config = $config;
$this->logger = $logger;
}
- /**
- * @param string $principalUri
- * @param string $uri
- */
public function refreshSubscription(string $principalUri, string $uri) {
$subscription = $this->getSubscription($principalUri, $uri);
$mutations = [];
@@ -143,7 +136,7 @@ class RefreshWebcalService {
try {
$this->calDavBackend->createCalendarObject($subscription['id'], $uri, $calendarData, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
} catch (NoInstancesException | BadRequest $ex) {
- $this->logger->logException($ex);
+ $this->logger->error($ex->getMessage(), ['exception' => $ex]);
}
}
@@ -156,8 +149,7 @@ class RefreshWebcalService {
} catch (ParseException $ex) {
$subscriptionId = $subscription['id'];
- $this->logger->logException($ex);
- $this->logger->warning("Subscription $subscriptionId could not be refreshed due to a parsing error");
+ $this->logger->error("Subscription $subscriptionId could not be refreshed due to a parsing error", ['exception' => $ex]);
}
}
@@ -279,16 +271,14 @@ class RefreshWebcalService {
return $vCalendar->serialize();
}
} catch (LocalServerException $ex) {
- $this->logger->logException($ex, [
- 'message' => "Subscription $subscriptionId was not refreshed because it violates local access rules",
- 'level' => ILogger::WARN,
+ $this->logger->warning("Subscription $subscriptionId was not refreshed because it violates local access rules", [
+ 'exception' => $ex,
]);
return null;
} catch (Exception $ex) {
- $this->logger->logException($ex, [
- 'message' => "Subscription $subscriptionId could not be refreshed due to a network error",
- 'level' => ILogger::WARN,
+ $this->logger->warning("Subscription $subscriptionId could not be refreshed due to a network error", [
+ 'exception' => $ex,
]);
return null;
diff --git a/apps/dav/lib/CardDAV/PhotoCache.php b/apps/dav/lib/CardDAV/PhotoCache.php
index d3e4b2450d3..66391b268a6 100644
--- a/apps/dav/lib/CardDAV/PhotoCache.php
+++ b/apps/dav/lib/CardDAV/PhotoCache.php
@@ -34,7 +34,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
use Sabre\CardDAV\Card;
use Sabre\VObject\Document;
use Sabre\VObject\Parameter;
@@ -54,16 +54,12 @@ class PhotoCache {
/** @var IAppData */
protected $appData;
- /** @var ILogger */
- protected $logger;
+ protected LoggerInterface $logger;
/**
* PhotoCache constructor.
- *
- * @param IAppData $appData
- * @param ILogger $logger
*/
- public function __construct(IAppData $appData, ILogger $logger) {
+ public function __construct(IAppData $appData, LoggerInterface $logger) {
$this->appData = $appData;
$this->logger = $logger;
}
@@ -216,8 +212,8 @@ class PhotoCache {
$vObject = $this->readCard($node->get());
return $this->getPhotoFromVObject($vObject);
} catch (\Exception $e) {
- $this->logger->logException($e, [
- 'message' => 'Exception during vcard photo parsing'
+ $this->logger->error('Exception during vcard photo parsing', [
+ 'exception' => $e
]);
}
return false;
@@ -262,8 +258,8 @@ class PhotoCache {
'body' => $val
];
} catch (\Exception $e) {
- $this->logger->logException($e, [
- 'message' => 'Exception during vcard photo parsing'
+ $this->logger->error('Exception during vcard photo parsing', [
+ 'exception' => $e
]);
}
return false;
diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php
index 73bfaf01b60..b93fd94f741 100644
--- a/apps/dav/lib/CardDAV/SyncService.php
+++ b/apps/dav/lib/CardDAV/SyncService.php
@@ -30,9 +30,9 @@ namespace OCA\DAV\CardDAV;
use OC\Accounts\AccountManager;
use OCP\AppFramework\Http;
-use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Client;
use Sabre\DAV\Xml\Response\MultiStatus;
use Sabre\DAV\Xml\Service;
@@ -47,8 +47,7 @@ class SyncService {
/** @var IUserManager */
private $userManager;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var array */
private $localSystemAddressBook;
@@ -61,13 +60,11 @@ class SyncService {
/**
* SyncService constructor.
- *
- * @param CardDavBackend $backend
- * @param IUserManager $userManager
- * @param ILogger $logger
- * @param AccountManager $accountManager
*/
- public function __construct(CardDavBackend $backend, IUserManager $userManager, ILogger $logger, Converter $converter) {
+ public function __construct(CardDavBackend $backend,
+ IUserManager $userManager,
+ LoggerInterface $logger,
+ Converter $converter) {
$this->backend = $backend;
$this->userManager = $userManager;
$this->logger = $logger;
diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php
index af76027671e..b41dbc276e8 100644
--- a/apps/dav/lib/Comments/CommentNode.php
+++ b/apps/dav/lib/Comments/CommentNode.php
@@ -26,9 +26,9 @@ namespace OCA\DAV\Comments;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
use OCP\Comments\MessageTooLongException;
-use OCP\ILogger;
use OCP\IUserManager;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\Exception\MethodNotAllowed;
@@ -52,8 +52,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
/** @var ICommentsManager */
protected $commentsManager;
- /** @var ILogger */
- protected $logger;
+ protected LoggerInterface $logger;
/** @var array list of properties with key being their name and value their setter */
protected $properties = [];
@@ -66,19 +65,13 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
/**
* CommentNode constructor.
- *
- * @param ICommentsManager $commentsManager
- * @param IComment $comment
- * @param IUserManager $userManager
- * @param IUserSession $userSession
- * @param ILogger $logger
*/
public function __construct(
ICommentsManager $commentsManager,
IComment $comment,
IUserManager $userManager,
IUserSession $userSession,
- ILogger $logger
+ LoggerInterface $logger
) {
$this->commentsManager = $commentsManager;
$this->comment = $comment;
@@ -194,7 +187,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
$this->commentsManager->save($this->comment);
return true;
} catch (\Exception $e) {
- $this->logger->logException($e, ['app' => 'dav/comments']);
+ $this->logger->error($e->getMessage(), ['app' => 'dav/comments', 'exception' => $e]);
if ($e instanceof MessageTooLongException) {
$msg = 'Message exceeds allowed character limit of ';
throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
@@ -287,7 +280,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
try {
$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
} catch (\OutOfBoundsException $e) {
- $this->logger->logException($e);
+ $this->logger->error($e->getMessage(), ['exception' => $e]);
// No displayname, upon client's discretion what to display.
$displayName = '';
}
diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php
index d9b06e1240c..164c690afd0 100644
--- a/apps/dav/lib/Comments/EntityCollection.php
+++ b/apps/dav/lib/Comments/EntityCollection.php
@@ -25,9 +25,9 @@ namespace OCA\DAV\Comments;
use OCP\Comments\ICommentsManager;
use OCP\Comments\NotFoundException;
-use OCP\ILogger;
use OCP\IUserManager;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\IProperties;
use Sabre\DAV\PropPatch;
@@ -46,8 +46,7 @@ class EntityCollection extends RootCollection implements IProperties {
/** @var string */
protected $id;
- /** @var ILogger */
- protected $logger;
+ protected LoggerInterface $logger;
/**
* @param string $id
@@ -55,7 +54,7 @@ class EntityCollection extends RootCollection implements IProperties {
* @param ICommentsManager $commentsManager
* @param IUserManager $userManager
* @param IUserSession $userSession
- * @param ILogger $logger
+ * @param LoggerInterface $logger
*/
public function __construct(
$id,
@@ -63,7 +62,7 @@ class EntityCollection extends RootCollection implements IProperties {
ICommentsManager $commentsManager,
IUserManager $userManager,
IUserSession $userSession,
- ILogger $logger
+ LoggerInterface $logger
) {
foreach (['id', 'name'] as $property) {
$$property = trim($$property);
diff --git a/apps/dav/lib/Comments/EntityTypeCollection.php b/apps/dav/lib/Comments/EntityTypeCollection.php
index c9df2a068d7..d140a33ec4c 100644
--- a/apps/dav/lib/Comments/EntityTypeCollection.php
+++ b/apps/dav/lib/Comments/EntityTypeCollection.php
@@ -24,9 +24,9 @@
namespace OCA\DAV\Comments;
use OCP\Comments\ICommentsManager;
-use OCP\ILogger;
use OCP\IUserManager;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\MethodNotAllowed;
use Sabre\DAV\Exception\NotFound;
@@ -43,8 +43,7 @@ use Sabre\DAV\Exception\NotFound;
*/
class EntityTypeCollection extends RootCollection {
- /** @var ILogger */
- protected $logger;
+ protected LoggerInterface $logger;
/** @var IUserManager */
protected $userManager;
@@ -57,7 +56,7 @@ class EntityTypeCollection extends RootCollection {
* @param ICommentsManager $commentsManager
* @param IUserManager $userManager
* @param IUserSession $userSession
- * @param ILogger $logger
+ * @param LoggerInterface $logger
* @param \Closure $childExistsFunction
*/
public function __construct(
@@ -65,7 +64,7 @@ class EntityTypeCollection extends RootCollection {
ICommentsManager $commentsManager,
IUserManager $userManager,
IUserSession $userSession,
- ILogger $logger,
+ LoggerInterface $logger,
\Closure $childExistsFunction
) {
$name = trim($name);
diff --git a/apps/dav/lib/Comments/RootCollection.php b/apps/dav/lib/Comments/RootCollection.php
index e8e890696eb..9832030291e 100644
--- a/apps/dav/lib/Comments/RootCollection.php
+++ b/apps/dav/lib/Comments/RootCollection.php
@@ -26,9 +26,9 @@ namespace OCA\DAV\Comments;
use OCP\Comments\CommentsEntityEvent;
use OCP\Comments\ICommentsManager;
-use OCP\ILogger;
use OCP\IUserManager;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\Exception\NotAuthenticated;
use Sabre\DAV\Exception\NotFound;
@@ -46,8 +46,7 @@ class RootCollection implements ICollection {
/** @var string */
protected $name = 'comments';
- /** @var ILogger */
- protected $logger;
+ protected LoggerInterface $logger;
/** @var IUserManager */
protected $userManager;
@@ -58,19 +57,12 @@ class RootCollection implements ICollection {
/** @var EventDispatcherInterface */
protected $dispatcher;
- /**
- * @param ICommentsManager $commentsManager
- * @param IUserManager $userManager
- * @param IUserSession $userSession
- * @param EventDispatcherInterface $dispatcher
- * @param ILogger $logger
- */
public function __construct(
ICommentsManager $commentsManager,
IUserManager $userManager,
IUserSession $userSession,
EventDispatcherInterface $dispatcher,
- ILogger $logger) {
+ LoggerInterface $logger) {
$this->commentsManager = $commentsManager;
$this->logger = $logger;
$this->userManager = $userManager;
diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php
index df4e3c65ce0..d81a3f9d667 100644
--- a/apps/dav/lib/Connector/Sabre/Auth.php
+++ b/apps/dav/lib/Connector/Sabre/Auth.php
@@ -41,6 +41,7 @@ use OC\User\Session;
use OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden;
use OCP\IRequest;
use OCP\ISession;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Auth\Backend\AbstractBasic;
use Sabre\DAV\Exception\NotAuthenticated;
use Sabre\DAV\Exception\ServiceUnavailable;
@@ -157,7 +158,7 @@ class Auth extends AbstractBasic {
} catch (Exception $e) {
$class = get_class($e);
$msg = $e->getMessage();
- \OC::$server->getLogger()->logException($e);
+ \OC::$server->get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]);
throw new ServiceUnavailable("$class: $msg");
}
}
diff --git a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
index b4df1f582db..e89ce3a8037 100644
--- a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
@@ -30,7 +30,7 @@ namespace OCA\DAV\Connector\Sabre;
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
use OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden;
use OCP\Files\StorageNotAvailableException;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\Conflict;
use Sabre\DAV\Exception\Forbidden;
@@ -86,14 +86,13 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
/** @var string */
private $appName;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/**
* @param string $loggerAppName app name to use when logging
- * @param ILogger $logger
+ * @param LoggerInterface $logger
*/
- public function __construct($loggerAppName, $logger) {
+ public function __construct($loggerAppName, LoggerInterface $logger) {
$this->appName = $loggerAppName;
$this->logger = $logger;
}
@@ -119,19 +118,21 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
*/
public function logException(\Throwable $ex) {
$exceptionClass = get_class($ex);
- $level = ILogger::FATAL;
if (isset($this->nonFatalExceptions[$exceptionClass]) ||
(
$exceptionClass === ServiceUnavailable::class &&
$ex->getMessage() === 'System in maintenance mode.'
)
) {
- $level = ILogger::DEBUG;
+ $this->logger->debug($ex->getMessage(), [
+ 'app' => $this->appName,
+ 'exception' => $ex,
+ ]);
+ } else {
+ $this->logger->critical($ex->getMessage(), [
+ 'app' => $this->appName,
+ 'exception' => $ex,
+ ]);
}
-
- $this->logger->logException($ex, [
- 'app' => $this->appName,
- 'level' => $level,
- ]);
}
}
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index 6c379984995..37fb109a3bd 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -63,11 +63,11 @@ use OCP\Files\NotPermittedException;
use OCP\Files\Storage;
use OCP\Files\StorageNotAvailableException;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\L10N\IFactory as IL10NFactory;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
use OCP\Share\IManager;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\Forbidden;
@@ -251,7 +251,7 @@ class File extends Node implements IFile {
} else {
$target = $partStorage->fopen($internalPartPath, 'wb');
if ($target === false) {
- \OC::$server->getLogger()->error('\OC\Files\Filesystem::fopen() failed', ['app' => 'webdav']);
+ \OC::$server->get(LoggerInterface::class)->error('\OC\Files\Filesystem::fopen() failed', ['app' => 'webdav']);
// because we have no clue about the cause we can only throw back a 500/Internal Server Error
throw new Exception($this->l10n->t('Could not write file contents'));
}
@@ -295,13 +295,12 @@ class File extends Node implements IFile {
}
}
} catch (\Exception $e) {
- $context = [];
-
if ($e instanceof LockedException) {
- $context['level'] = ILogger::DEBUG;
+ \OC::$server->get(LoggerInterface::class)->debug($e->getMessage(), ['exception' => $e]);
+ } else {
+ \OC::$server->get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]);
}
- \OC::$server->getLogger()->logException($e, $context);
if ($needsPartFile) {
$partStorage->unlink($internalPartPath);
}
@@ -340,7 +339,7 @@ class File extends Node implements IFile {
$renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath);
$fileExists = $storage->file_exists($internalPath);
if ($renameOkay === false || $fileExists === false) {
- \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: ' . ($renameOkay ? 'true' : 'false') . ', $fileExists: ' . ($fileExists ? 'true' : 'false') . ')', ['app' => 'webdav']);
+ \OC::$server->get(LoggerInterface::class)->error('renaming part file to final file failed $renameOkay: ' . ($renameOkay ? 'true' : 'false') . ', $fileExists: ' . ($fileExists ? 'true' : 'false') . ')', ['app' => 'webdav']);
throw new Exception($this->l10n->t('Could not rename part file to final file'));
}
} catch (ForbiddenException $ex) {
@@ -626,7 +625,7 @@ class File extends Node implements IFile {
$renameOkay = $targetStorage->moveFromStorage($partStorage, $partInternalPath, $targetInternalPath);
$fileExists = $targetStorage->file_exists($targetInternalPath);
if ($renameOkay === false || $fileExists === false) {
- \OC::$server->getLogger()->error('\OC\Files\Filesystem::rename() failed', ['app' => 'webdav']);
+ \OC::$server->get(LoggerInterface::class)->error('\OC\Files\Filesystem::rename() failed', ['app' => 'webdav']);
// only delete if an error occurred and the target file was already created
if ($fileExists) {
// set to null to avoid double-deletion when handling exception
diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php
index b13dbd20ca9..635645ed992 100644
--- a/apps/dav/lib/Connector/Sabre/ServerFactory.php
+++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php
@@ -38,20 +38,19 @@ use OCP\Files\Mount\IMountManager;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IPreview;
use OCP\IRequest;
use OCP\ITagManager;
use OCP\IUserSession;
use OCP\SabrePluginEvent;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Auth\Plugin;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class ServerFactory {
/** @var IConfig */
private $config;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var IDBConnection */
private $databaseConnection;
/** @var IUserSession */
@@ -69,19 +68,9 @@ class ServerFactory {
/** @var IL10N */
private $l10n;
- /**
- * @param IConfig $config
- * @param ILogger $logger
- * @param IDBConnection $databaseConnection
- * @param IUserSession $userSession
- * @param IMountManager $mountManager
- * @param ITagManager $tagManager
- * @param IRequest $request
- * @param IPreview $previewManager
- */
public function __construct(
IConfig $config,
- ILogger $logger,
+ LoggerInterface $logger,
IDBConnection $databaseConnection,
IUserSession $userSession,
IMountManager $mountManager,
diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php
index 1287104fd10..fcb6839a1f9 100644
--- a/apps/dav/lib/HookManager.php
+++ b/apps/dav/lib/HookManager.php
@@ -176,8 +176,8 @@ class HookManager {
'{http://apple.com/ns/ical/}calendar-color' => $this->themingDefaults->getColorPrimary(),
'components' => 'VEVENT'
]);
- } catch (\Exception $ex) {
- \OC::$server->getLogger()->logException($ex);
+ } catch (\Exception $e) {
+ \OC::$server->get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]);
}
}
if ($this->cardDav->getAddressBooksForUserCount($principal) === 0) {
@@ -185,8 +185,8 @@ class HookManager {
$this->cardDav->createAddressBook($principal, CardDavBackend::PERSONAL_ADDRESSBOOK_URI, [
'{DAV:}displayname' => CardDavBackend::PERSONAL_ADDRESSBOOK_NAME,
]);
- } catch (\Exception $ex) {
- \OC::$server->getLogger()->logException($ex);
+ } catch (\Exception $e) {
+ \OC::$server->get(LoggerInterface::class)->error($e->getMessage(), ['exception' => $e]);
}
}
}
diff --git a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php
index 5e575347d95..9b96df2ae1e 100644
--- a/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php
+++ b/apps/dav/lib/Migration/CalDAVRemoveEmptyValue.php
@@ -28,9 +28,9 @@ use Doctrine\DBAL\Platforms\OraclePlatform;
use OCA\DAV\CalDAV\CalDavBackend;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
-use OCP\ILogger;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
+use Psr\Log\LoggerInterface;
use Sabre\VObject\InvalidDataException;
class CalDAVRemoveEmptyValue implements IRepairStep {
@@ -41,15 +41,9 @@ class CalDAVRemoveEmptyValue implements IRepairStep {
/** @var CalDavBackend */
private $calDavBackend;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
- /**
- * @param IDBConnection $db
- * @param CalDavBackend $calDavBackend
- * @param ILogger $logger
- */
- public function __construct(IDBConnection $db, CalDavBackend $calDavBackend, ILogger $logger) {
+ public function __construct(IDBConnection $db, CalDavBackend $calDavBackend, LoggerInterface $logger) {
$this->db = $db;
$this->calDavBackend = $calDavBackend;
$this->logger = $logger;
diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php
index 2e5952f6efd..8a11a676609 100644
--- a/apps/dav/lib/RootCollection.php
+++ b/apps/dav/lib/RootCollection.php
@@ -54,8 +54,7 @@ class RootCollection extends SimpleCollection {
public function __construct() {
$l10n = \OC::$server->getL10N('dav');
$random = \OC::$server->getSecureRandom();
- $logger = \OC::$server->getLogger();
- $psrLogger = \OC::$server->get(LoggerInterface::class);
+ $logger = \OC::$server->get(LoggerInterface::class);
$userManager = \OC::$server->getUserManager();
$userSession = \OC::$server->getUserSession();
$groupManager = \OC::$server->getGroupManager();
@@ -109,15 +108,15 @@ class RootCollection extends SimpleCollection {
$legacyDispatcher,
$config
);
- $userCalendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users', $psrLogger);
+ $userCalendarRoot = new CalendarRoot($userPrincipalBackend, $caldavBackend, 'principals/users', $logger);
$userCalendarRoot->disableListing = $disableListing;
- $resourceCalendarRoot = new CalendarRoot($calendarResourcePrincipalBackend, $caldavBackend, 'principals/calendar-resources', $psrLogger);
+ $resourceCalendarRoot = new CalendarRoot($calendarResourcePrincipalBackend, $caldavBackend, 'principals/calendar-resources', $logger);
$resourceCalendarRoot->disableListing = $disableListing;
- $roomCalendarRoot = new CalendarRoot($calendarRoomPrincipalBackend, $caldavBackend, 'principals/calendar-rooms', $psrLogger);
+ $roomCalendarRoot = new CalendarRoot($calendarRoomPrincipalBackend, $caldavBackend, 'principals/calendar-rooms', $logger);
$roomCalendarRoot->disableListing = $disableListing;
- $publicCalendarRoot = new PublicCalendarRoot($caldavBackend, $l10n, $config, $psrLogger);
+ $publicCalendarRoot = new PublicCalendarRoot($caldavBackend, $l10n, $config, $logger);
$publicCalendarRoot->disableListing = $disableListing;
$systemTagCollection = new SystemTag\SystemTagsByIdCollection(
@@ -137,7 +136,7 @@ class RootCollection extends SimpleCollection {
$userManager,
\OC::$server->getUserSession(),
\OC::$server->getEventDispatcher(),
- \OC::$server->getLogger()
+ $logger
);
$pluginManager = new PluginManager(\OC::$server, \OC::$server->query(IAppManager::class));
diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php
index 589e6c2bd6c..383bb9cd8d8 100644
--- a/apps/dav/lib/Server.php
+++ b/apps/dav/lib/Server.php
@@ -34,13 +34,8 @@
*/
namespace OCA\DAV;
-use OCA\DAV\Connector\Sabre\RequestIdHeaderPlugin;
-use OCP\Diagnostics\IEventLogger;
-use OCP\Profiler\IProfiler;
-use OCA\DAV\Profiler\ProfilerPlugin;
-use OCP\AppFramework\Http\Response;
-use Psr\Log\LoggerInterface;
use OCA\DAV\AppInfo\PluginManager;
+use OCA\DAV\BulkUpload\BulkUploadPlugin;
use OCA\DAV\CalDAV\BirthdayService;
use OCA\DAV\CardDAV\HasPhotoPlugin;
use OCA\DAV\CardDAV\ImageExportPlugin;
@@ -62,6 +57,7 @@ use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCA\DAV\Connector\Sabre\FilesReportPlugin;
use OCA\DAV\Connector\Sabre\PropfindCompressionPlugin;
use OCA\DAV\Connector\Sabre\QuotaPlugin;
+use OCA\DAV\Connector\Sabre\RequestIdHeaderPlugin;
use OCA\DAV\Connector\Sabre\SharesPlugin;
use OCA\DAV\Connector\Sabre\TagsPlugin;
use OCA\DAV\DAV\CustomPropertiesBackend;
@@ -69,13 +65,17 @@ use OCA\DAV\DAV\PublicAuth;
use OCA\DAV\Events\SabrePluginAuthInitEvent;
use OCA\DAV\Files\BrowserErrorPagePlugin;
use OCA\DAV\Files\LazySearchBackend;
-use OCA\DAV\BulkUpload\BulkUploadPlugin;
+use OCA\DAV\Profiler\ProfilerPlugin;
use OCA\DAV\Provisioning\Apple\AppleProvisioningPlugin;
use OCA\DAV\SystemTag\SystemTagPlugin;
use OCA\DAV\Upload\ChunkingPlugin;
+use OCP\AppFramework\Http\Response;
+use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IRequest;
+use OCP\Profiler\IProfiler;
use OCP\SabrePluginEvent;
+use Psr\Log\LoggerInterface;
use Sabre\CardDAV\VCFExportPlugin;
use Sabre\DAV\Auth\Plugin;
use Sabre\DAV\UUIDUtil;
@@ -97,7 +97,7 @@ class Server {
$this->request = $request;
$this->baseUri = $baseUri;
- $logger = \OC::$server->getLogger();
+ $logger = \OC::$server->get(LoggerInterface::class);
$dispatcher = \OC::$server->getEventDispatcher();
/** @var IEventDispatcher $newDispatcher */
$newDispatcher = \OC::$server->query(IEventDispatcher::class);
@@ -168,7 +168,7 @@ class Server {
// calendar plugins
if ($this->requestIsForSubtree(['calendars', 'public-calendars', 'system-calendars', 'principals'])) {
$this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin());
- $this->server->addPlugin(new \OCA\DAV\CalDAV\ICSExportPlugin\ICSExportPlugin(\OC::$server->getConfig(), \OC::$server->getLogger()));
+ $this->server->addPlugin(new \OCA\DAV\CalDAV\ICSExportPlugin\ICSExportPlugin(\OC::$server->getConfig(), $logger));
$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin(\OC::$server->getConfig()));
if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') {
$this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
@@ -195,7 +195,7 @@ class Server {
$this->server->addPlugin(new HasPhotoPlugin());
$this->server->addPlugin(new ImageExportPlugin(new PhotoCache(
\OC::$server->getAppDataDir('dav-photocache'),
- \OC::$server->getLogger())
+ $logger)
));
}
@@ -306,7 +306,6 @@ class Server {
\OC::$server->getShareManager(),
$view
));
- $logger = \OC::$server->get(LoggerInterface::class);
$this->server->addPlugin(
new BulkUploadPlugin($userFolder, $logger)
);