aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-04-25 14:57:08 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-04-26 12:10:53 +0200
commit0e6a3175162a1312c1035c4a2630a26f8c26d561 (patch)
tree85fb444ff7efdb01f79aa537de542bdd577a9a44 /lib/private
parent69592408c4ef2b891c2d73f704611d2eabe5813a (diff)
downloadnextcloud-server-0e6a3175162a1312c1035c4a2630a26f8c26d561.tar.gz
nextcloud-server-0e6a3175162a1312c1035c4a2630a26f8c26d561.zip
revert Log's dependency to SystemConfig to work during Installation
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Log.php13
-rw-r--r--lib/private/Log/LogFactory.php9
-rw-r--r--lib/private/Server.php3
3 files changed, 15 insertions, 10 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php
index 099cc56776b..69705c49e87 100644
--- a/lib/private/Log.php
+++ b/lib/private/Log.php
@@ -39,7 +39,6 @@ use InterfaSys\LogNormalizer\Normalizer;
use OC\Log\ExceptionSerializer;
use OCP\Log\IFileBased;
-use OCP\IConfig;
use OCP\Log\IWriter;
use OCP\ILogger;
use OCP\Support\CrashReport\IRegistry;
@@ -59,7 +58,7 @@ class Log implements ILogger {
/** @var IWriter */
private $logger;
- /** @var IConfig */
+ /** @var SystemConfig */
private $config;
/** @var boolean|null cache the result of the log condition check for the request */
@@ -73,14 +72,14 @@ class Log implements ILogger {
/**
* @param IWriter $logger The logger that should be used
- * @param IConfig $config the system config object
+ * @param SystemConfig $config the system config object
* @param Normalizer|null $normalizer
* @param IRegistry|null $registry
*/
- public function __construct(IWriter $logger, IConfig $config = null, $normalizer = null, IRegistry $registry = null) {
+ public function __construct(IWriter $logger, SystemConfig $config = null, $normalizer = null, IRegistry $registry = null) {
// FIXME: Add this for backwards compatibility, should be fixed at some point probably
if ($config === null) {
- $config = \OC::$server->getConfig();
+ $config = \OC::$server->getSystemConfig();
}
$this->config = $config;
@@ -258,7 +257,7 @@ class Log implements ILogger {
}
if (isset($context['app'])) {
- $logCondition = $this->config->getSystemValue('log.condition', []);
+ $logCondition = $this->config->getValue('log.condition', []);
$app = $context['app'];
/**
@@ -272,7 +271,7 @@ class Log implements ILogger {
}
}
- return min($this->config->getSystemValue('loglevel', ILogger::WARN), ILogger::FATAL);
+ return min($this->config->getValue('loglevel', ILogger::WARN), ILogger::FATAL);
}
/**
diff --git a/lib/private/Log/LogFactory.php b/lib/private/Log/LogFactory.php
index c1a4d00ceaa..63f08a32320 100644
--- a/lib/private/Log/LogFactory.php
+++ b/lib/private/Log/LogFactory.php
@@ -23,6 +23,7 @@
namespace OC\Log;
+use OC\AllConfig;
use OC\Log;
use OCP\ILogger;
use OCP\IServerContainer;
@@ -60,8 +61,14 @@ class LogFactory implements ILogFactory {
}
public function getCustomLogger(string $path):ILogger {
+ $systemConfig = null;
+ $iconfig = $this->c->getConfig();
+ if($iconfig instanceof AllConfig) {
+ // Log is bound to SystemConfig, but fetches it from \OC::$server if not supplied
+ $systemConfig = $iconfig->getSystemConfig();
+ }
$log = $this->buildLogFile($path);
- return new Log($log, $this->c->getConfig());
+ return new Log($log, $systemConfig);
}
protected function buildLogFile(string $logFile = ''):File {
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 05772555a03..c744ba37ded 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -550,10 +550,9 @@ class Server extends ServerContainer implements IServerContainer {
$logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
$factory = new LogFactory($c);
$logger = $factory->get($logType);
- $config = $this->getConfig();
$registry = $c->query(\OCP\Support\CrashReport\IRegistry::class);
- return new Log($logger, $config, null, $registry);
+ return new Log($logger, $this->getSystemConfig(), null, $registry);
});
$this->registerAlias('Logger', \OCP\ILogger::class);