aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Cache/CacheQueryBuilder.php4
-rw-r--r--lib/private/Files/Cache/QuerySearchHelper.php7
-rw-r--r--lib/private/Files/Config/UserMountCache.php13
-rw-r--r--lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php7
-rw-r--r--lib/private/Files/Node/Root.php9
-rw-r--r--lib/private/Files/ObjectStore/SwiftFactory.php10
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php40
-rw-r--r--lib/private/Files/Type/Detection.php13
-rw-r--r--lib/private/Files/Utils/Scanner.php11
9 files changed, 40 insertions, 74 deletions
diff --git a/lib/private/Files/Cache/CacheQueryBuilder.php b/lib/private/Files/Cache/CacheQueryBuilder.php
index 87a1f940f20..b5a9101877c 100644
--- a/lib/private/Files/Cache/CacheQueryBuilder.php
+++ b/lib/private/Files/Cache/CacheQueryBuilder.php
@@ -29,7 +29,7 @@ use OC\DB\QueryBuilder\QueryBuilder;
use OC\SystemConfig;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
/**
* Query builder with commonly used helpers for filecache queries
@@ -37,7 +37,7 @@ use OCP\ILogger;
class CacheQueryBuilder extends QueryBuilder {
private $alias = null;
- public function __construct(IDBConnection $connection, SystemConfig $systemConfig, ILogger $logger) {
+ public function __construct(IDBConnection $connection, SystemConfig $systemConfig, LoggerInterface $logger) {
parent::__construct($connection, $systemConfig, $logger);
}
diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php
index e065e95e4fd..3bf9abf3524 100644
--- a/lib/private/Files/Cache/QuerySearchHelper.php
+++ b/lib/private/Files/Cache/QuerySearchHelper.php
@@ -34,7 +34,7 @@ use OCP\Files\IMimeTypeLoader;
use OCP\Files\Search\ISearchBinaryOperator;
use OCP\Files\Search\ISearchQuery;
use OCP\IDBConnection;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
class QuerySearchHelper {
@@ -44,8 +44,7 @@ class QuerySearchHelper {
private $connection;
/** @var SystemConfig */
private $systemConfig;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var SearchBuilder */
private $searchBuilder;
/** @var QueryOptimizer */
@@ -55,7 +54,7 @@ class QuerySearchHelper {
IMimeTypeLoader $mimetypeLoader,
IDBConnection $connection,
SystemConfig $systemConfig,
- ILogger $logger,
+ LoggerInterface $logger,
SearchBuilder $searchBuilder,
QueryOptimizer $queryOptimizer
) {
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index dc2640361e7..538f48012e2 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -38,9 +38,9 @@ use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
use OCP\ICache;
use OCP\IDBConnection;
-use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
+use Psr\Log\LoggerInterface;
/**
* Cache mounts points per user in the cache so we can easilly look them up
@@ -64,10 +64,7 @@ class UserMountCache implements IUserMountCache {
**/
private $mountsForUsers;
- /**
- * @var ILogger
- */
- private $logger;
+ private LoggerInterface $logger;
/**
* @var ICache
@@ -76,12 +73,8 @@ class UserMountCache implements IUserMountCache {
/**
* UserMountCache constructor.
- *
- * @param IDBConnection $connection
- * @param IUserManager $userManager
- * @param ILogger $logger
*/
- public function __construct(IDBConnection $connection, IUserManager $userManager, ILogger $logger) {
+ public function __construct(IDBConnection $connection, IUserManager $userManager, LoggerInterface $logger) {
$this->connection = $connection;
$this->userManager = $userManager;
$this->logger = $logger;
diff --git a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
index 0043503f2cd..3a20afba5a5 100644
--- a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
+++ b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php
@@ -31,18 +31,17 @@ use OC\Files\Storage\Wrapper\Jail;
use OCP\Files\Config\IRootMountProvider;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
/**
* Mount provider for object store app data folder for previews
*/
class ObjectStorePreviewCacheMountProvider implements IRootMountProvider {
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var IConfig */
private $config;
- public function __construct(ILogger $logger, IConfig $config) {
+ public function __construct(LoggerInterface $logger, IConfig $config) {
$this->logger = $logger;
$this->config = $config;
}
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 88ac4a31d34..ab44d179d69 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -44,9 +44,9 @@ use OCP\Files\Events\Node\FilesystemTornDownEvent;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
-use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
+use Psr\Log\LoggerInterface;
/**
* Class Root
@@ -73,7 +73,7 @@ class Root extends Folder implements IRootFolder {
private ?IUser $user;
private CappedMemoryCache $userFolderCache;
private IUserMountCache $userMountCache;
- private ILogger $logger;
+ private LoggerInterface $logger;
private IUserManager $userManager;
private IEventDispatcher $eventDispatcher;
@@ -81,16 +81,13 @@ class Root extends Folder implements IRootFolder {
* @param Manager $manager
* @param View $view
* @param IUser|null $user
- * @param IUserMountCache $userMountCache
- * @param ILogger $logger
- * @param IUserManager $userManager
*/
public function __construct(
$manager,
$view,
$user,
IUserMountCache $userMountCache,
- ILogger $logger,
+ LoggerInterface $logger,
IUserManager $userManager,
IEventDispatcher $eventDispatcher
) {
diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php
index df4b5a93678..bd75ccada2e 100644
--- a/lib/private/Files/ObjectStore/SwiftFactory.php
+++ b/lib/private/Files/ObjectStore/SwiftFactory.php
@@ -40,7 +40,6 @@ use GuzzleHttp\HandlerStack;
use OCP\Files\StorageAuthException;
use OCP\Files\StorageNotAvailableException;
use OCP\ICache;
-use OCP\ILogger;
use OpenStack\Common\Auth\Token;
use OpenStack\Common\Error\BadResponseError;
use OpenStack\Common\Transport\Utils as TransportUtils;
@@ -50,13 +49,14 @@ use OpenStack\Identity\v3\Service as IdentityV3Service;
use OpenStack\ObjectStore\v1\Models\Container;
use OpenStack\OpenStack;
use Psr\Http\Message\RequestInterface;
+use Psr\Log\LoggerInterface;
class SwiftFactory {
private $cache;
private $params;
/** @var Container|null */
private $container = null;
- private $logger;
+ private LoggerInterface $logger;
public const DEFAULT_OPTIONS = [
'autocreate' => false,
@@ -65,7 +65,7 @@ class SwiftFactory {
'catalogType' => 'object-store'
];
- public function __construct(ICache $cache, array $params, ILogger $logger) {
+ public function __construct(ICache $cache, array $params, LoggerInterface $logger) {
$this->cache = $cache;
$this->params = $params;
$this->logger = $logger;
@@ -203,7 +203,7 @@ class SwiftFactory {
$this->logger->debug('Cached token for swift expired');
}
} catch (\Exception $e) {
- $this->logger->logException($e);
+ $this->logger->error($e->getMessage(), ['exception' => $e]);
}
}
}
@@ -279,7 +279,7 @@ class SwiftFactory {
/** @var RequestInterface $request */
$request = $e->getRequest();
$host = $request->getUri()->getHost() . ':' . $request->getUri()->getPort();
- \OC::$server->getLogger()->error("Can't connect to object storage server at $host");
+ $this->logger->error("Can't connect to object storage server at $host", ['exception' => $e]);
throw new StorageNotAvailableException("Can't connect to object storage server at $host", StorageNotAvailableException::STATUS_ERROR, $e);
}
}
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index 75611d1ab0f..a03dd0ba441 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -50,7 +50,7 @@ use OCP\Encryption\Keys\IStorage;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Storage;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
class Encryption extends Wrapper {
use LocalTempFileTrait;
@@ -64,8 +64,7 @@ class Encryption extends Wrapper {
/** @var \OCP\Encryption\IManager */
private $encryptionManager;
- /** @var \OCP\ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var string */
private $uid;
@@ -96,27 +95,18 @@ class Encryption extends Wrapper {
/**
* @param array $parameters
- * @param IManager $encryptionManager
- * @param Util $util
- * @param ILogger $logger
- * @param IFile $fileHelper
- * @param string $uid
- * @param IStorage $keyStorage
- * @param Update $update
- * @param Manager $mountManager
- * @param ArrayCache $arrayCache
*/
public function __construct(
$parameters,
- IManager $encryptionManager = null,
- Util $util = null,
- ILogger $logger = null,
- IFile $fileHelper = null,
- $uid = null,
- IStorage $keyStorage = null,
- Update $update = null,
- Manager $mountManager = null,
- ArrayCache $arrayCache = null
+ IManager $encryptionManager,
+ Util $util,
+ LoggerInterface $logger,
+ IFile $fileHelper,
+ string $uid,
+ IStorage $keyStorage,
+ Update $update,
+ Manager $mountManager,
+ ArrayCache $arrayCache
) {
$this->mountPoint = $parameters['mountPoint'];
$this->mount = $parameters['mount'];
@@ -448,9 +438,8 @@ class Encryption extends Wrapper {
}
}
} catch (ModuleDoesNotExistsException $e) {
- $this->logger->logException($e, [
- 'message' => 'Encryption module "' . $encryptionModuleId . '" not found, file will be stored unencrypted',
- 'level' => ILogger::WARN,
+ $this->logger->warning('Encryption module "' . $encryptionModuleId . '" not found, file will be stored unencrypted', [
+ 'exception' => $e,
'app' => 'core',
]);
}
@@ -503,8 +492,7 @@ class Encryption extends Wrapper {
try {
$result = $this->fixUnencryptedSize($path, $size, $unencryptedSize);
} catch (\Exception $e) {
- $this->logger->error('Couldn\'t re-calculate unencrypted size for ' . $path);
- $this->logger->logException($e);
+ $this->logger->error('Couldn\'t re-calculate unencrypted size for ' . $path, ['exception' => $e]);
}
unset($this->fixUnencryptedSizeOf[$this->getFullPath($path)]);
}
diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php
index bd2bfb5f939..4cade024460 100644
--- a/lib/private/Files/Type/Detection.php
+++ b/lib/private/Files/Type/Detection.php
@@ -42,8 +42,8 @@ declare(strict_types=1);
namespace OC\Files\Type;
use OCP\Files\IMimeTypeDetector;
-use OCP\ILogger;
use OCP\IURLGenerator;
+use Psr\Log\LoggerInterface;
/**
* Class Detection
@@ -66,8 +66,7 @@ class Detection implements IMimeTypeDetector {
/** @var IURLGenerator */
private $urlGenerator;
- /** @var ILogger */
- private $logger;
+ private LoggerInterface $logger;
/** @var string */
private $customConfigDir;
@@ -75,14 +74,8 @@ class Detection implements IMimeTypeDetector {
/** @var string */
private $defaultConfigDir;
- /**
- * @param IURLGenerator $urlGenerator
- * @param ILogger $logger
- * @param string $customConfigDir
- * @param string $defaultConfigDir
- */
public function __construct(IURLGenerator $urlGenerator,
- ILogger $logger,
+ LoggerInterface $logger,
string $customConfigDir,
string $defaultConfigDir) {
$this->urlGenerator = $urlGenerator;
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php
index 5b633617608..dc220bc710d 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -48,7 +48,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\IDBConnection;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
/**
* Class Scanner
@@ -71,8 +71,7 @@ class Scanner extends PublicEmitter {
/** @var IEventDispatcher */
private $dispatcher;
- /** @var ILogger */
- protected $logger;
+ protected LoggerInterface $logger;
/**
* Whether to use a DB transaction
@@ -92,9 +91,8 @@ class Scanner extends PublicEmitter {
* @param string $user
* @param IDBConnection|null $db
* @param IEventDispatcher $dispatcher
- * @param ILogger $logger
*/
- public function __construct($user, $db, IEventDispatcher $dispatcher, ILogger $logger) {
+ public function __construct($user, $db, IEventDispatcher $dispatcher, LoggerInterface $logger) {
$this->user = $user;
$this->db = $db;
$this->dispatcher = $dispatcher;
@@ -263,8 +261,7 @@ class Scanner extends PublicEmitter {
}
$propagator->commitBatch();
} catch (StorageNotAvailableException $e) {
- $this->logger->error('Storage ' . $storage->getId() . ' not available');
- $this->logger->logException($e);
+ $this->logger->error('Storage ' . $storage->getId() . ' not available', ['exception' => $e]);
$this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]);
}
if ($this->useTransaction) {