diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-03-17 16:42:53 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-03-24 16:21:25 +0100 |
commit | 6be7aa112f6174c1406cfef5449836124a7f6f50 (patch) | |
tree | 5029bf9659caeab8702e9fabbbdeb9a2cd849bfa /lib/private/Repair | |
parent | fbf1334dc8c192ebdd335663cacfb810daf4d841 (diff) | |
download | nextcloud-server-6be7aa112f6174c1406cfef5449836124a7f6f50.tar.gz nextcloud-server-6be7aa112f6174c1406cfef5449836124a7f6f50.zip |
Migrate from ILogger to LoggerInterface in lib/private
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Repair')
-rw-r--r-- | lib/private/Repair/Collation.php | 19 | ||||
-rw-r--r-- | lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php | 11 | ||||
-rw-r--r-- | lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php | 13 |
3 files changed, 18 insertions, 25 deletions
diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index e949c261b80..25e85f00af8 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -30,16 +30,15 @@ use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Platforms\MySQLPlatform; use OCP\IConfig; use OCP\IDBConnection; -use OCP\ILogger; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; +use Psr\Log\LoggerInterface; class Collation implements IRepairStep { /** @var IConfig */ protected $config; - /** @var ILogger */ - protected $logger; + protected LoggerInterface $logger; /** @var IDBConnection */ protected $connection; @@ -48,12 +47,14 @@ class Collation implements IRepairStep { protected $ignoreFailures; /** - * @param IConfig $config - * @param ILogger $logger - * @param IDBConnection $connection * @param bool $ignoreFailures */ - public function __construct(IConfig $config, ILogger $logger, IDBConnection $connection, $ignoreFailures) { + public function __construct( + IConfig $config, + LoggerInterface $logger, + IDBConnection $connection, + $ignoreFailures + ) { $this->connection = $connection; $this->config = $config; $this->logger = $logger; @@ -83,7 +84,7 @@ class Collation implements IRepairStep { $query->execute(); } catch (DriverException $e) { // Just log this - $this->logger->logException($e); + $this->logger->error($e->getMessage(), ['exception' => $e]); if (!$this->ignoreFailures) { throw $e; } @@ -95,7 +96,7 @@ class Collation implements IRepairStep { $query->execute(); } catch (DriverException $e) { // Just log this - $this->logger->logException($e); + $this->logger->error($e->getMessage(), ['exception' => $e]); if (!$this->ignoreFailures) { throw $e; } diff --git a/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php b/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php index 39b48562791..25dc24fb66c 100644 --- a/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php +++ b/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php @@ -30,9 +30,9 @@ use OCP\Files\IAppData; use OCP\Files\NotFoundException; use OCP\Files\SimpleFS\ISimpleFolder; use OCP\IConfig; -use OCP\ILogger; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; +use Psr\Log\LoggerInterface; use RuntimeException; /** @@ -52,10 +52,9 @@ class CleanupCardDAVPhotoCache implements IRepairStep { /** @var IAppData */ private $appData; - /** @var ILogger */ - private $logger; + private LoggerInterface $logger; - public function __construct(IConfig $config, IAppData $appData, ILogger $logger) { + public function __construct(IConfig $config, IAppData $appData, LoggerInterface $logger) { $this->config = $config; $this->appData = $appData; $this->logger = $logger; @@ -71,7 +70,7 @@ class CleanupCardDAVPhotoCache implements IRepairStep { } catch (NotFoundException $e) { return; } catch (RuntimeException $e) { - $this->logger->logException($e, ['message' => 'Failed to fetch directory listing in CleanupCardDAVPhotoCache']); + $this->logger->error('Failed to fetch directory listing in CleanupCardDAVPhotoCache', ['exception' => $e]); return; } @@ -90,7 +89,7 @@ class CleanupCardDAVPhotoCache implements IRepairStep { /** @var ISimpleFolder $folder */ $folder->getFile('photo.')->delete(); } catch (\Exception $e) { - $this->logger->logException($e); + $this->logger->error($e->getMessage(), ['exception' => $e]); $output->warning('Could not delete file "dav-photocache/' . $folder->getName() . '/photo."'); } } diff --git a/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php b/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php index 67f9d6912d9..7f4bbc35c17 100644 --- a/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php +++ b/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php @@ -29,15 +29,14 @@ use OCP\Files\Folder; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; -use OCP\ILogger; use OCP\IUserManager; +use Psr\Log\LoggerInterface; class CleanPreviewsBackgroundJob extends QueuedJob { /** @var IRootFolder */ private $rootFolder; - /** @var ILogger */ - private $logger; + private LoggerInterface $logger; /** @var IJobList */ private $jobList; @@ -50,15 +49,9 @@ class CleanPreviewsBackgroundJob extends QueuedJob { /** * CleanPreviewsBackgroundJob constructor. - * - * @param IRootFolder $rootFolder - * @param ILogger $logger - * @param IJobList $jobList - * @param ITimeFactory $timeFactory - * @param IUserManager $userManager */ public function __construct(IRootFolder $rootFolder, - ILogger $logger, + LoggerInterface $logger, IJobList $jobList, ITimeFactory $timeFactory, IUserManager $userManager) { |