mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
Adapt more code to migration to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
eb961e4700
commit
ea23523c70
13 changed files with 104 additions and 104 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ use Icewind\Streams\IteratorDirectory;
|
|||
use OC\Files\ObjectStore\SwiftFactory;
|
||||
use OCP\Files\IMimeTypeDetector;
|
||||
use OCP\Files\StorageBadConfigException;
|
||||
use OCP\ILogger;
|
||||
use OpenStack\Common\Error\BadResponseError;
|
||||
use OpenStack\ObjectStore\v1\Models\StorageObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Swift extends \OC\Files\Storage\Common {
|
||||
/** @var SwiftFactory */
|
||||
|
|
@ -138,8 +138,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
} catch (BadResponseError $e) {
|
||||
// Expected response is "404 Not Found", so only log if it isn't
|
||||
if ($e->getResponse()->getStatusCode() !== 404) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->connectionFactory = new SwiftFactory(
|
||||
\OC::$server->getMemCacheFactory()->createDistributed('swift/'),
|
||||
$this->params,
|
||||
\OC::$server->getLogger()
|
||||
\OC::$server->get(LoggerInterface::class)
|
||||
);
|
||||
$this->objectStore = new \OC\Files\ObjectStore\Swift($this->params, $this->connectionFactory);
|
||||
$this->bucket = $params['bucket'];
|
||||
|
|
@ -232,8 +232,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
// with all properties
|
||||
$this->objectCache->remove($path);
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
|
@ -276,8 +276,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->objectStore->deleteObject($path . '/');
|
||||
$this->objectCache->remove($path . '/');
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
|
@ -314,8 +314,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
|
||||
return IteratorDirectory::wrap($files);
|
||||
} catch (\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
|
@ -337,8 +337,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
return false;
|
||||
}
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
|
@ -391,8 +391,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->objectCache->remove($path . '/');
|
||||
} catch (BadResponseError $e) {
|
||||
if ($e->getResponse()->getStatusCode() !== 404) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
throw $e;
|
||||
|
|
@ -415,8 +415,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
try {
|
||||
return $this->objectStore->readObject($path);
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
|
@ -502,8 +502,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->objectCache->remove($path2);
|
||||
$this->objectCache->remove($path2 . '/');
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
|
@ -518,8 +518,8 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
$this->objectCache->remove($path2);
|
||||
$this->objectCache->remove($path2 . '/');
|
||||
} catch (BadResponseError $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'level' => ILogger::ERROR,
|
||||
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'files_external',
|
||||
]);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ use OCP\Files\NotFoundException;
|
|||
use OCP\Files\NotPermittedException;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
use OCP\Lock\LockedException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Trashbin {
|
||||
|
||||
|
|
@ -227,7 +228,7 @@ class Trashbin {
|
|||
->setValue('user', $query->createNamedParameter($user));
|
||||
$result = $query->executeStatement();
|
||||
if (!$result) {
|
||||
\OC::$server->getLogger()->error('trash bin database couldn\'t be updated for the files owner', ['app' => 'files_trashbin']);
|
||||
\OC::$server->get(LoggerInterface::class)->error('trash bin database couldn\'t be updated for the files owner', ['app' => 'files_trashbin']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -326,7 +327,7 @@ class Trashbin {
|
|||
if ($trashStorage->file_exists($trashInternalPath)) {
|
||||
$trashStorage->unlink($trashInternalPath);
|
||||
}
|
||||
\OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']);
|
||||
\OC::$server->get(LoggerInterface::class)->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']);
|
||||
}
|
||||
|
||||
if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort
|
||||
|
|
@ -354,7 +355,7 @@ class Trashbin {
|
|||
->setValue('user', $query->createNamedParameter($owner));
|
||||
$result = $query->executeStatement();
|
||||
if (!$result) {
|
||||
\OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
|
||||
\OC::$server->get(LoggerInterface::class)->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
|
||||
}
|
||||
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path),
|
||||
'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]);
|
||||
|
|
@ -470,7 +471,7 @@ class Trashbin {
|
|||
if ($timestamp) {
|
||||
$location = self::getLocation($user, $filename, $timestamp);
|
||||
if ($location === false) {
|
||||
\OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']);
|
||||
\OC::$server->get(LoggerInterface::class)->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']);
|
||||
} else {
|
||||
// if location no longer exists, restore file in the root directory
|
||||
if ($location !== '/' &&
|
||||
|
|
@ -870,7 +871,7 @@ class Trashbin {
|
|||
foreach ($files as $file) {
|
||||
if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) {
|
||||
$tmp = self::delete($file['name'], $user, $file['mtime']);
|
||||
\OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
|
||||
\OC::$server->get(LoggerInterface::class)->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
|
||||
$availableSpace += $tmp;
|
||||
$size += $tmp;
|
||||
} else {
|
||||
|
|
@ -901,9 +902,14 @@ class Trashbin {
|
|||
$size += self::delete($filename, $user, $timestamp);
|
||||
$count++;
|
||||
} catch (\OCP\Files\NotPermittedException $e) {
|
||||
\OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "' . $filename . '" from trashbin failed.']);
|
||||
\OC::$server->get(LoggerInterface::class)->warning('Removing "' . $filename . '" from trashbin failed.',
|
||||
[
|
||||
'exception' => $e,
|
||||
'app' => 'files_trashbin',
|
||||
]
|
||||
);
|
||||
}
|
||||
\OC::$server->getLogger()->info(
|
||||
\OC::$server->get(LoggerInterface::class)->info(
|
||||
'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.',
|
||||
['app' => 'files_trashbin']
|
||||
);
|
||||
|
|
@ -999,7 +1005,7 @@ class Trashbin {
|
|||
$query = new CacheQueryBuilder(
|
||||
\OC::$server->getDatabaseConnection(),
|
||||
\OC::$server->getSystemConfig(),
|
||||
\OC::$server->getLogger()
|
||||
\OC::$server->get(LoggerInterface::class)
|
||||
);
|
||||
$normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'. $filename)), '/');
|
||||
$parentId = $cache->getId($normalizedParentPath);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace OCA\Testing\Locking;
|
|||
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class FakeDBLockingProvider extends \OC\Lock\DBLockingProvider {
|
||||
// Lock for 10 hours just to be sure
|
||||
|
|
@ -37,12 +37,11 @@ class FakeDBLockingProvider extends \OC\Lock\DBLockingProvider {
|
|||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @param \OCP\IDBConnection $connection
|
||||
* @param \OCP\ILogger $logger
|
||||
* @param \OCP\AppFramework\Utility\ITimeFactory $timeFactory
|
||||
*/
|
||||
public function __construct(IDBConnection $connection, ILogger $logger, ITimeFactory $timeFactory) {
|
||||
public function __construct(
|
||||
IDBConnection $connection,
|
||||
LoggerInterface $logger,
|
||||
ITimeFactory $timeFactory
|
||||
) {
|
||||
parent::__construct($connection, $logger, $timeFactory);
|
||||
$this->db = $connection;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ use OC\Migration\ConsoleOutput;
|
|||
use OC\Repair\Collation;
|
||||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\ILogger;
|
||||
use OCP\IURLGenerator;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
|
@ -46,16 +46,14 @@ class ConvertMysqlToMB4 extends Command {
|
|||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
/** @var ILogger */
|
||||
private $logger;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
* @param IDBConnection $connection
|
||||
* @param IURLGenerator $urlGenerator
|
||||
* @param ILogger $logger
|
||||
*/
|
||||
public function __construct(IConfig $config, IDBConnection $connection, IURLGenerator $urlGenerator, ILogger $logger) {
|
||||
public function __construct(
|
||||
IConfig $config,
|
||||
IDBConnection $connection,
|
||||
IURLGenerator $urlGenerator,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->connection = $connection;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ use Doctrine\DBAL\Platforms\SqlitePlatform;
|
|||
use Doctrine\DBAL\Result;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Statement;
|
||||
use OC\DB\QueryBuilder\QueryBuilder;
|
||||
use OC\SystemConfig;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequestId;
|
||||
use OCP\PreConditionNotMetException;
|
||||
use OC\DB\QueryBuilder\QueryBuilder;
|
||||
use OC\SystemConfig;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Connection extends \Doctrine\DBAL\Connection {
|
||||
/** @var string */
|
||||
|
|
@ -66,8 +66,7 @@ class Connection extends \Doctrine\DBAL\Connection {
|
|||
/** @var SystemConfig */
|
||||
private $systemConfig;
|
||||
|
||||
/** @var ILogger */
|
||||
private $logger;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
protected $lockedTable = null;
|
||||
|
||||
|
|
@ -77,6 +76,34 @@ class Connection extends \Doctrine\DBAL\Connection {
|
|||
/** @var int */
|
||||
protected $queriesExecuted = 0;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the Connection class.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(
|
||||
array $params,
|
||||
Driver $driver,
|
||||
?Configuration $config = null,
|
||||
?EventManager $eventManager = null
|
||||
) {
|
||||
if (!isset($params['adapter'])) {
|
||||
throw new \Exception('adapter not set');
|
||||
}
|
||||
if (!isset($params['tablePrefix'])) {
|
||||
throw new \Exception('tablePrefix not set');
|
||||
}
|
||||
/**
|
||||
* @psalm-suppress InternalMethod
|
||||
*/
|
||||
parent::__construct($params, $driver, $config, $eventManager);
|
||||
$this->adapter = new $params['adapter']($this);
|
||||
$this->tablePrefix = $params['tablePrefix'];
|
||||
|
||||
$this->systemConfig = \OC::$server->getSystemConfig();
|
||||
$this->logger = \OC::$server->get(LoggerInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
|
|
@ -126,7 +153,7 @@ class Connection extends \Doctrine\DBAL\Connection {
|
|||
*/
|
||||
public function createQueryBuilder() {
|
||||
$backtrace = $this->getCallerBacktrace();
|
||||
\OC::$server->getLogger()->debug('Doctrine QueryBuilder retrieved in {backtrace}', ['app' => 'core', 'backtrace' => $backtrace]);
|
||||
$this->logger->debug('Doctrine QueryBuilder retrieved in {backtrace}', ['app' => 'core', 'backtrace' => $backtrace]);
|
||||
$this->queriesBuilt++;
|
||||
return parent::createQueryBuilder();
|
||||
}
|
||||
|
|
@ -139,7 +166,7 @@ class Connection extends \Doctrine\DBAL\Connection {
|
|||
*/
|
||||
public function getExpressionBuilder() {
|
||||
$backtrace = $this->getCallerBacktrace();
|
||||
\OC::$server->getLogger()->debug('Doctrine ExpressionBuilder retrieved in {backtrace}', ['app' => 'core', 'backtrace' => $backtrace]);
|
||||
$this->logger->debug('Doctrine ExpressionBuilder retrieved in {backtrace}', ['app' => 'core', 'backtrace' => $backtrace]);
|
||||
$this->queriesBuilt++;
|
||||
return parent::getExpressionBuilder();
|
||||
}
|
||||
|
|
@ -168,34 +195,6 @@ class Connection extends \Doctrine\DBAL\Connection {
|
|||
return $this->tablePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the Connection class.
|
||||
*
|
||||
* @param array $params The connection parameters.
|
||||
* @param \Doctrine\DBAL\Driver $driver
|
||||
* @param \Doctrine\DBAL\Configuration $config
|
||||
* @param \Doctrine\Common\EventManager $eventManager
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(array $params, Driver $driver, Configuration $config = null,
|
||||
EventManager $eventManager = null) {
|
||||
if (!isset($params['adapter'])) {
|
||||
throw new \Exception('adapter not set');
|
||||
}
|
||||
if (!isset($params['tablePrefix'])) {
|
||||
throw new \Exception('tablePrefix not set');
|
||||
}
|
||||
/**
|
||||
* @psalm-suppress InternalMethod
|
||||
*/
|
||||
parent::__construct($params, $driver, $config, $eventManager);
|
||||
$this->adapter = new $params['adapter']($this);
|
||||
$this->tablePrefix = $params['tablePrefix'];
|
||||
|
||||
$this->systemConfig = \OC::$server->getSystemConfig();
|
||||
$this->logger = \OC::$server->getLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares an SQL statement.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ use OCP\AppFramework\App;
|
|||
use OCP\AppFramework\QueryException;
|
||||
use OCP\Migration\IMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class MigrationService {
|
||||
|
||||
|
|
@ -73,7 +74,7 @@ class MigrationService {
|
|||
$this->connection = $connection;
|
||||
$this->output = $output;
|
||||
if (null === $this->output) {
|
||||
$this->output = new SimpleOutput(\OC::$server->getLogger(), $appName);
|
||||
$this->output = new SimpleOutput(\OC::$server->get(LoggerInterface::class), $appName);
|
||||
}
|
||||
|
||||
if ($appName === 'core') {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ use OCP\Files\Search\ISearchOperator;
|
|||
use OCP\Files\Search\ISearchQuery;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
use OCP\IDBConnection;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Metadata cache for a storage
|
||||
|
|
@ -128,7 +129,7 @@ class Cache implements ICache {
|
|||
return new CacheQueryBuilder(
|
||||
$this->connection,
|
||||
\OC::$server->getSystemConfig(),
|
||||
\OC::$server->getLogger()
|
||||
\OC::$server->get(LoggerInterface::class)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -590,7 +591,7 @@ class Cache implements ICache {
|
|||
$query = $this->getQueryBuilder();
|
||||
$query->delete('filecache_extended')
|
||||
->where($query->expr()->in('fileid', $query->createParameter('childIds')));
|
||||
|
||||
|
||||
foreach (array_chunk($childIds, 1000) as $childIdChunk) {
|
||||
$query->setParameter('childIds', $childIdChunk, IQueryBuilder::PARAM_INT_ARRAY);
|
||||
$query->execute();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ use Icewind\Streams\RetryWrapper;
|
|||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\ObjectStore\IObjectStore;
|
||||
use OCP\Files\StorageAuthException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
const SWIFT_SEGMENT_SIZE = 1073741824; // 1GB
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ class Swift implements IObjectStore {
|
|||
$this->swiftFactory = $connectionFactory ?: new SwiftFactory(
|
||||
\OC::$server->getMemCacheFactory()->createDistributed('swift::'),
|
||||
$params,
|
||||
\OC::$server->getLogger()
|
||||
\OC::$server->get(LoggerInterface::class)
|
||||
);
|
||||
$this->params = $params;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,13 +93,12 @@ class Repair implements IOutput {
|
|||
/** @var string */
|
||||
private $currentStep;
|
||||
|
||||
private $logger;
|
||||
private LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* Creates a new repair step runner
|
||||
*
|
||||
* @param IRepairStep[] $repairSteps array of RepairStep instances
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
*/
|
||||
public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher, LoggerInterface $logger) {
|
||||
$this->repairSteps = $repairSteps;
|
||||
|
|
@ -171,7 +170,7 @@ class Repair implements IOutput {
|
|||
*/
|
||||
public static function getRepairSteps() {
|
||||
return [
|
||||
new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->getDatabaseConnection(), false),
|
||||
new Collation(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->getDatabaseConnection(), false),
|
||||
new RepairMimeTypes(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()),
|
||||
new CleanTags(\OC::$server->getDatabaseConnection(), \OC::$server->getUserManager()),
|
||||
new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()),
|
||||
|
|
@ -197,7 +196,7 @@ class Repair implements IOutput {
|
|||
new ClearGeneratedAvatarCache(\OC::$server->getConfig(), \OC::$server->query(AvatarManager::class)),
|
||||
new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()),
|
||||
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
|
||||
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->getLogger()),
|
||||
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->get(LoggerInterface::class)),
|
||||
new AddClenupLoginFlowV2BackgroundJob(\OC::$server->getJobList()),
|
||||
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OC::$server->query(ITimeFactory::class)),
|
||||
new ClearCollectionsAccessCache(\OC::$server->getConfig(), \OC::$server->query(IManager::class)),
|
||||
|
|
@ -238,7 +237,7 @@ class Repair implements IOutput {
|
|||
$connectionAdapter = \OC::$server->get(ConnectionAdapter::class);
|
||||
$config = \OC::$server->getConfig();
|
||||
$steps = [
|
||||
new Collation(\OC::$server->getConfig(), \OC::$server->getLogger(), $connectionAdapter, true),
|
||||
new Collation(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), $connectionAdapter, true),
|
||||
new SqliteAutoincrement($connection),
|
||||
new SaveAccountsTableData($connectionAdapter, $config),
|
||||
new DropAccountTermsTable($connectionAdapter),
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ use OCP\IUserSession;
|
|||
use OCP\Support\Subscription\IRegistry;
|
||||
use OCP\UserStatus\IManager as IUserStatusManager;
|
||||
use OCP\Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class TemplateLayout extends \OC_Template {
|
||||
private static $versionHash = '';
|
||||
|
|
@ -345,7 +346,7 @@ class TemplateLayout extends \OC_Template {
|
|||
}
|
||||
|
||||
$locator = new \OC\Template\CSSResourceLocator(
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(LoggerInterface::class),
|
||||
$theme,
|
||||
[ \OC::$SERVERROOT => \OC::$WEBROOT ],
|
||||
[ \OC::$SERVERROOT => \OC::$WEBROOT ],
|
||||
|
|
@ -380,7 +381,7 @@ class TemplateLayout extends \OC_Template {
|
|||
$theme = \OC_Util::getTheme();
|
||||
|
||||
$locator = new \OC\Template\JSResourceLocator(
|
||||
\OC::$server->getLogger(),
|
||||
\OC::$server->get(LoggerInterface::class),
|
||||
$theme,
|
||||
[ \OC::$SERVERROOT => \OC::$WEBROOT ],
|
||||
[ \OC::$SERVERROOT => \OC::$WEBROOT ],
|
||||
|
|
|
|||
Loading…
Reference in a new issue