Skip to content
Prev Previous commit
Next Next commit
Adapted Server to logger migration in constructors
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Mar 24, 2022
commit eb961e47003ee5b6d7328caf10ecd5f53cc93666
42 changes: 25 additions & 17 deletions lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public function __construct($webRoot, \OC\Config $config) {
);
return new Encryption\Manager(
$c->get(\OCP\IConfig::class),
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
$c->getL10N('core'),
new View(),
$util,
Expand Down Expand Up @@ -428,7 +428,7 @@ public function __construct($webRoot, \OC\Config $config) {
$view,
null,
$c->get(IUserMountCache::class),
$this->get(ILogger::class),
$this->get(LoggerInterface::class),
$this->get(IUserManager::class),
$this->get(IEventDispatcher::class),
);
Expand Down Expand Up @@ -466,7 +466,11 @@ public function __construct($webRoot, \OC\Config $config) {
$this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class);

$this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) {
$groupManager = new \OC\Group\Manager($this->get(IUserManager::class), $c->get(SymfonyAdapter::class), $this->get(ILogger::class));
$groupManager = new \OC\Group\Manager(
$this->get(IUserManager::class),
$c->get(SymfonyAdapter::class),
$this->get(LoggerInterface::class)
);
$groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->get(IEventDispatcher::class);
Expand Down Expand Up @@ -547,7 +551,7 @@ public function __construct($webRoot, \OC\Config $config) {
$c->get(\OCP\IConfig::class),
$c->get(ISecureRandom::class),
$c->getLockdownManager(),
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
$c->get(IEventDispatcher::class)
);
/** @deprecated 21.0.0 use BeforeUserCreatedEvent event with the IEventDispatcher instead */
Expand Down Expand Up @@ -687,7 +691,9 @@ public function __construct($webRoot, \OC\Config $config) {
$this->registerDeprecatedAlias('UserCache', ICache::class);

$this->registerService(Factory::class, function (Server $c) {
$arrayCacheFactory = new \OC\Memcache\Factory('', $c->get(ILogger::class),
$arrayCacheFactory = new \OC\Memcache\Factory(
'',
$c->get(LoggerInterface::class),
ArrayCache::class,
ArrayCache::class,
ArrayCache::class
Expand All @@ -711,7 +717,9 @@ public function __construct($webRoot, \OC\Config $config) {
$instanceId = \OC_Util::getInstanceId();
$path = \OC::$SERVERROOT;
$prefix = md5($instanceId . '-' . $version . '-' . $path);
return new \OC\Memcache\Factory($prefix, $c->get(ILogger::class),
return new \OC\Memcache\Factory(
$prefix,
$c->get(LoggerInterface::class),
$config->getSystemValue('memcache.local', null),
$config->getSystemValue('memcache.distributed', null),
$config->getSystemValue('memcache.locking', null),
Expand Down Expand Up @@ -792,7 +800,7 @@ public function __construct($webRoot, \OC\Config $config) {

$this->registerService(Router::class, function (Server $c) {
$cacheFactory = $c->get(ICacheFactory::class);
$logger = $c->get(ILogger::class);
$logger = $c->get(LoggerInterface::class);
if ($cacheFactory->isLocalCacheAvailable()) {
$router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger);
} else {
Expand Down Expand Up @@ -863,7 +871,7 @@ public function __construct($webRoot, \OC\Config $config) {
$this->registerAlias(IClientService::class, ClientService::class);
$this->registerService(LocalAddressChecker::class, function (ContainerInterface $c) {
return new LocalAddressChecker(
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
);
});
$this->registerService(NegativeDnsCache::class, function (ContainerInterface $c) {
Expand Down Expand Up @@ -934,7 +942,7 @@ public function __construct($webRoot, \OC\Config $config) {
$mountCache = new UserMountCache(
$c->get(IDBConnection::class),
$c->get(IUserManager::class),
$c->get(ILogger::class)
$c->get(LoggerInterface::class)
);
$listener = new UserMountCacheListener($mountCache);
$listener->listen($c->get(IUserManager::class));
Expand All @@ -951,7 +959,7 @@ public function __construct($webRoot, \OC\Config $config) {
// builtin providers

$config = $c->get(\OCP\IConfig::class);
$logger = $c->get(ILogger::class);
$logger = $c->get(LoggerInterface::class);
$manager->registerProvider(new CacheMountProvider($config));
$manager->registerHomeProvider(new LocalHomeMountProvider());
$manager->registerHomeProvider(new ObjectHomeMountProvider($config));
Expand Down Expand Up @@ -1054,7 +1062,7 @@ public function __construct($webRoot, \OC\Config $config) {
$this->registerService(IMailer::class, function (Server $c) {
return new Mailer(
$c->get(\OCP\IConfig::class),
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
$c->get(Defaults::class),
$c->get(IURLGenerator::class),
$c->getL10N('lib'),
Expand Down Expand Up @@ -1094,7 +1102,7 @@ public function __construct($webRoot, \OC\Config $config) {
}
return new DBLockingProvider(
$c->get(IDBConnection::class),
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
new TimeFactory(),
$ttl,
!\OC::$CLI
Expand All @@ -1117,7 +1125,7 @@ public function __construct($webRoot, \OC\Config $config) {
$this->registerService(IMimeTypeDetector::class, function (ContainerInterface $c) {
return new \OC\Files\Type\Detection(
$c->get(IURLGenerator::class),
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
\OC::$configDir,
\OC::$SERVERROOT . '/resources/config/'
);
Expand Down Expand Up @@ -1214,7 +1222,7 @@ public function __construct($webRoot, \OC\Config $config) {
$c->get(IURLGenerator::class),
$this->get(ICacheFactory::class),
$c->get(SystemConfig::class),
$c->get(ILogger::class)
$c->get(LoggerInterface::class)
);
});
$this->registerAlias(\OCP\EventDispatcher\IEventDispatcher::class, \OC\EventDispatcher\EventDispatcher::class);
Expand Down Expand Up @@ -1263,7 +1271,7 @@ public function __construct($webRoot, \OC\Config $config) {
$factory = new $factoryClass($this);

$manager = new \OC\Share20\Manager(
$c->get(ILogger::class),
$c->get(LoggerInterface::class),
$c->get(\OCP\IConfig::class),
$c->get(ISecureRandom::class),
$c->get(IHasher::class),
Expand Down Expand Up @@ -1342,7 +1350,7 @@ public function __construct($webRoot, \OC\Config $config) {
$c->get(IAppManager::class),
$c->get(IClientService::class),
$c->get(ICloudIdManager::class),
$c->get(ILogger::class)
$c->get(LoggerInterface::class)
);
});

Expand Down Expand Up @@ -1451,7 +1459,7 @@ private function connectDispatcher() {

// Delete avatar on user deletion
$dispatcher->addListener('OCP\IUser::preDelete', function (GenericEvent $e) {
$logger = $this->get(ILogger::class);
$logger = $this->get(LoggerInterface::class);
$manager = $this->getAvatarManager();
/** @var IUser $user */
$user = $e->getSubject();
Expand Down