Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c8c8f93
Move createSubscription and deleteSubscription event handlers to
tcitworld Dec 17, 2021
bfdfd3e
Remove uses of LegacyDispatcher for create/delete subscriptions
tcitworld Dec 17, 2021
dfa2cc3
Move every event to listeners and remove all uses of legacy dispatcher
tcitworld Dec 17, 2021
10af3ab
Add tests for new Listeners
tcitworld Dec 17, 2021
180e695
Remove usages of legacyDispatcher in CardDAVBackend
tcitworld Dec 19, 2021
ab07629
Update some depreciated calls
tcitworld Dec 19, 2021
08abaae
Fix doctype of param passed to deleteContact
tcitworld Dec 19, 2021
4827bc7
Improve OCA\DAV\Connector\Sabre\Principal
tcitworld Dec 19, 2021
aa7994f
Improve OCA\DAV\Tests\unit\CardDAV\AddressBookImplTest
tcitworld Dec 19, 2021
3a3a1a0
Move uses of ILogger to LoggerInterface
tcitworld Dec 19, 2021
fed15f9
Move some events to IEventDispatcher
tcitworld Dec 19, 2021
c304561
Replace calls to Sabre's depreciated getPropertiesForPath with getPro…
tcitworld Jan 16, 2022
981b99c
Remove more depreciated calls
tcitworld Jan 20, 2022
dcc9c70
Remove HookManager and replace with UserChangeListener
tcitworld Jan 20, 2022
7a5f4af
Modernize endpoints
tcitworld Jan 20, 2022
d739f92
Modernize Sabre Connector
tcitworld Jan 20, 2022
244aaa7
Add @template-implements metadata for listeners
tcitworld Jan 20, 2022
57ddf28
Remove CalendarManager registration
tcitworld Jan 20, 2022
fccc89d
Various fixes
tcitworld Jan 20, 2022
041526d
Improve tests
tcitworld Jan 26, 2022
3d42336
Improve CommentsEntityEvent
tcitworld Jan 26, 2022
9246d06
Use PHP 7.4 typed properties
tcitworld Feb 14, 2022
6d6008d
Rebasing, cs and more typing
tcitworld Mar 24, 2022
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
Prev Previous commit
Next Next commit
Move uses of ILogger to LoggerInterface
Except for BackgroundJobs

Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Mar 31, 2022
commit 3a3a1a02a0215175d0ab00635ba1a149d40e510a
10 changes: 5 additions & 5 deletions apps/dav/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@
use OCP\BackgroundJob\IJobList;
use OCP\Calendar\IManager as ICalendarManager;
use OCP\Contacts\IManager as IContactsManager;
use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Throwable;
Expand All @@ -122,7 +122,7 @@ public function register(IRegistrationContext $context): void {

return new PhotoCache(
$server->getAppDataDir('dav-photocache'),
$c->get(ILogger::class)
$c->get(LoggerInterface::class)
);
});

Expand Down Expand Up @@ -254,7 +254,7 @@ function (GenericEvent $event) {
$job->run([]);
$serverContainer->get(IJobList::class)->setLastRun($job);
} catch (Exception $ex) {
$serverContainer->getLogger()->logException($ex);
$serverContainer->get(LoggerInterface::class)->error('Error while setting last run for UpdateCalendarResourcesRoomsBackgroundJob', ['exception' => $ex]);
}
};

Expand Down Expand Up @@ -308,13 +308,13 @@ private function setupCalendarProvider(ICalendarManager $calendarManager,
}

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('Error while registering calendar reminder provider', ['exception' => $ex]);
}
}
}
10 changes: 5 additions & 5 deletions apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\QueuedJob;
use OCP\IDBConnection;
use OCP\ILogger;
use Psr\Log\LoggerInterface;

/**
* Class BuildReminderIndexBackgroundJob
Expand All @@ -47,7 +47,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
/** @var ReminderService */
private $reminderService;

/** @var ILogger */
/** @var LoggerInterface */
private $logger;

/** @var IJobList */
Expand All @@ -61,13 +61,13 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
*
* @param IDBConnection $db
* @param ReminderService $reminderService
* @param ILogger $logger
* @param LoggerInterface $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);
Expand Down Expand Up @@ -126,7 +126,7 @@ private function buildIndex(int $offset, int $stopAt):int {
try {
$this->reminderService->onCalendarObjectCreate($row);
} catch (\Exception $ex) {
$this->logger->logException($ex);
$this->logger->error('Error while building reminder index', ['exception' => $ex]);
}

if (($this->timeFactory->getTime() - $startTime) > 15) {
Expand Down
3 changes: 1 addition & 2 deletions apps/dav/lib/BackgroundJob/RefreshWebcalJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ public function execute(IJobList $jobList, ILogger $logger = null) {
/** @var DateInterval $dateInterval */
$dateInterval = DateTimeParser::parseDuration($refreshRate);
} catch (InvalidDataException $ex) {
$this->logger->logException($ex);
$this->logger->warning("Subscription $subscriptionId could not be refreshed, refreshrate in database is invalid");
$this->logger->warning("Subscription $subscriptionId could not be refreshed, refreshrate in database is invalid", ['exception' => $ex]);
return;
}

Expand Down
16 changes: 8 additions & 8 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
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;
Expand Down Expand Up @@ -217,7 +217,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
/** @var ISecureRandom */
private $random;

/** @var ILogger */
/** @var LoggerInterface */
private $logger;

/** @var IEventDispatcher */
Expand All @@ -240,7 +240,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* @param IUserManager $userManager
* @param IGroupManager $groupManager
* @param ISecureRandom $random
* @param ILogger $logger
* @param LoggerInterface $logger
* @param IEventDispatcher $dispatcher
* @param bool $legacyEndpoint
*/
Expand All @@ -249,7 +249,7 @@ public function __construct(IDBConnection $db,
IUserManager $userManager,
IGroupManager $groupManager,
ISecureRandom $random,
ILogger $logger,
LoggerInterface $logger,
IEventDispatcher $dispatcher,
IConfig $config,
bool $legacyEndpoint = false) {
Expand Down Expand Up @@ -1705,15 +1705,15 @@ public function calendarQuery($calendarId, array $filters, $calendarType = self:
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;
}
Expand Down
6 changes: 3 additions & 3 deletions apps/dav/lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,7 +39,7 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin {
/** @var IConfig */
private $config;

/** @var ILogger */
/** @var LoggerInterface */
private $logger;

/** @var string */
Expand All @@ -50,7 +50,7 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin {
*
* @param IConfig $config
*/
public function __construct(IConfig $config, ILogger $logger) {
public function __construct(IConfig $config, LoggerInterface $logger) {
$this->config = $config;
$this->logger = $logger;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use OCP\IConfig;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use Psr\Log\LoggerInterface;
use Sabre\VObject\ITip\Message;

class InvitationResponseServer {
Expand All @@ -53,7 +54,7 @@ class InvitationResponseServer {
*/
public function __construct(bool $public = true) {
$baseUri = \OC::$WEBROOT . '/remote.php/dav/';
$logger = \OC::$server->getLogger();
$logger = \OC::$server->get(LoggerInterface::class);
/** @var IEventDispatcher $dispatcher */
$dispatcher = \OC::$server->get(IEventDispatcher::class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
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;
Expand All @@ -50,7 +50,7 @@ abstract class AbstractProvider implements INotificationProvider {
/** @var string */
public const NOTIFICATION_TYPE = '';

/** @var ILogger */
/** @var LoggerInterface */
protected $logger;

/** @var L10NFactory */
Expand All @@ -69,12 +69,12 @@ abstract class AbstractProvider implements INotificationProvider {
protected $config;

/**
* @param ILogger $logger
* @param LoggerInterface $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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
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;
Expand All @@ -60,13 +60,13 @@ class EmailProvider extends AbstractProvider {
/**
* @param IConfig $config
* @param IMailer $mailer
* @param ILogger $logger
* @param LoggerInterface $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);
Expand Down Expand Up @@ -133,7 +133,7 @@ public function send(VEvent $vevent,
$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('Unable to deliver reminder message', ['app' => 'dav', 'exception' => $ex]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
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;

Expand All @@ -60,14 +60,14 @@ class PushProvider extends AbstractProvider {
/**
* @param IConfig $config
* @param IManager $manager
* @param ILogger $logger
* @param LoggerInterface $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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
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;
Expand All @@ -54,7 +54,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
/** @var IGroupManager */
private $groupManager;

/** @var ILogger */
/** @var LoggerInterface */
private $logger;

/** @var ProxyMapper */
Expand All @@ -79,15 +79,15 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
* @param IDBConnection $dbConnection
* @param IUserSession $userSession
* @param IGroupManager $groupManager
* @param ILogger $logger
* @param LoggerInterface $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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;

/**
* Class ResourcePrincipalBackend
Expand All @@ -41,13 +41,13 @@ class ResourcePrincipalBackend extends AbstractPrincipalBackend {
* @param IDBConnection $dbConnection
* @param IUserSession $userSession
* @param IGroupManager $groupManager
* @param ILogger $logger
* @param LoggerInterface $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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;

/**
* Class RoomPrincipalBackend
Expand All @@ -41,13 +41,13 @@ class RoomPrincipalBackend extends AbstractPrincipalBackend {
* @param IDBConnection $dbConnection
* @param IUserSession $userSession
* @param IGroupManager $groupManager
* @param ILogger $logger
* @param LoggerInterface $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');
Expand Down
Loading