diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2022-03-29 09:39:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-29 09:39:38 +0200 |
commit | 765999f454c0c5ebd8f2aa693d123f62d104d37a (patch) | |
tree | ee986c4dcb0edac3babb7ee87e5afc159087e2e0 /apps/files | |
parent | 4a4f250a2b733f915e8b465bc995ea8ac18a8fbc (diff) | |
parent | 6d354595f71f15f3d15bce70683b4bc013a6bfaf (diff) | |
download | nextcloud-server-765999f454c0c5ebd8f2aa693d123f62d104d37a.tar.gz nextcloud-server-765999f454c0c5ebd8f2aa693d123f62d104d37a.zip |
Merge pull request #31609 from nextcloud/fix/migrate-away-from-ilogger
Migrate from ILogger to LoggerInterface in lib/private
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/BackgroundJob/ScanFiles.php | 15 | ||||
-rw-r--r-- | apps/files/lib/Command/Scan.php | 3 | ||||
-rw-r--r-- | apps/files/lib/Command/ScanAppData.php | 3 | ||||
-rw-r--r-- | apps/files/tests/BackgroundJob/ScanFilesTest.php | 4 |
4 files changed, 10 insertions, 15 deletions
diff --git a/apps/files/lib/BackgroundJob/ScanFiles.php b/apps/files/lib/BackgroundJob/ScanFiles.php index 84846b9b55d..07794a28774 100644 --- a/apps/files/lib/BackgroundJob/ScanFiles.php +++ b/apps/files/lib/BackgroundJob/ScanFiles.php @@ -29,7 +29,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IDBConnection; -use OCP\ILogger; +use Psr\Log\LoggerInterface; /** * Class ScanFiles is a background job used to run the file scanner over the user @@ -42,23 +42,16 @@ class ScanFiles extends \OC\BackgroundJob\TimedJob { private $config; /** @var IEventDispatcher */ private $dispatcher; - /** @var ILogger */ - private $logger; + private LoggerInterface $logger; private $connection; /** Amount of users that should get scanned per execution */ public const USERS_PER_SESSION = 500; - /** - * @param IConfig $config - * @param IEventDispatcher $dispatcher - * @param ILogger $logger - * @param IDBConnection $connection - */ public function __construct( IConfig $config, IEventDispatcher $dispatcher, - ILogger $logger, + LoggerInterface $logger, IDBConnection $connection ) { // Run once per 10 minutes @@ -83,7 +76,7 @@ class ScanFiles extends \OC\BackgroundJob\TimedJob { ); $scanner->backgroundScan(''); } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'files']); + $this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'files']); } \OC_Util::tearDownFS(); } diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index ff96fbf2dab..47f1caabc78 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -43,6 +43,7 @@ use OCP\Files\Mount\IMountPoint; use OCP\Files\NotFoundException; use OCP\Files\StorageNotAvailableException; use OCP\IUserManager; +use Psr\Log\LoggerInterface; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -111,7 +112,7 @@ class Scan extends Base { $user, new ConnectionAdapter($connection), \OC::$server->query(IEventDispatcher::class), - \OC::$server->getLogger() + \OC::$server->get(LoggerInterface::class) ); # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception diff --git a/apps/files/lib/Command/ScanAppData.php b/apps/files/lib/Command/ScanAppData.php index 59281b52bc4..a5e9d99f804 100644 --- a/apps/files/lib/Command/ScanAppData.php +++ b/apps/files/lib/Command/ScanAppData.php @@ -38,6 +38,7 @@ use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\Files\StorageNotAvailableException; use OCP\IConfig; +use Psr\Log\LoggerInterface; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -95,7 +96,7 @@ class ScanAppData extends Base { null, new ConnectionAdapter($connection), \OC::$server->query(IEventDispatcher::class), - \OC::$server->getLogger() + \OC::$server->get(LoggerInterface::class) ); # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception diff --git a/apps/files/tests/BackgroundJob/ScanFilesTest.php b/apps/files/tests/BackgroundJob/ScanFilesTest.php index 04eeff4a30b..5b2d52b48d3 100644 --- a/apps/files/tests/BackgroundJob/ScanFilesTest.php +++ b/apps/files/tests/BackgroundJob/ScanFilesTest.php @@ -28,8 +28,8 @@ use OC\Files\Storage\Temporary; use OCA\Files\BackgroundJob\ScanFiles; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; -use OCP\ILogger; use OCP\IUser; +use Psr\Log\LoggerInterface; use Test\TestCase; use Test\Traits\MountProviderTrait; use Test\Traits\UserTrait; @@ -54,7 +54,7 @@ class ScanFilesTest extends TestCase { $config = $this->createMock(IConfig::class); $dispatcher = $this->createMock(IEventDispatcher::class); - $logger = $this->createMock(ILogger::class); + $logger = $this->createMock(LoggerInterface::class); $connection = \OC::$server->getDatabaseConnection(); $this->mountCache = \OC::$server->getUserMountCache(); |