aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Console
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-10-31 12:06:09 +0100
committerJoas Schilling <coding@schilljs.com>2023-11-03 15:44:46 +0100
commit6f39d82031202a2a8d1fb81ea448a2ffdc52cc29 (patch)
tree26f76451f1462ea5669f1d53e9cd0ebf7d79e7f2 /lib/private/Console
parent50de7553b582744c7376ca5c7bcff0ba47c1e6b3 (diff)
downloadnextcloud-server-6f39d82031202a2a8d1fb81ea448a2ffdc52cc29.tar.gz
nextcloud-server-6f39d82031202a2a8d1fb81ea448a2ffdc52cc29.zip
fix(install): Make installing more verbose
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Console')
-rw-r--r--lib/private/Console/TimestampFormatter.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/private/Console/TimestampFormatter.php b/lib/private/Console/TimestampFormatter.php
index 8d74c28e94f..afb1f67c37f 100644
--- a/lib/private/Console/TimestampFormatter.php
+++ b/lib/private/Console/TimestampFormatter.php
@@ -27,17 +27,17 @@ use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyleInterface;
class TimestampFormatter implements OutputFormatterInterface {
- /** @var IConfig */
+ /** @var ?IConfig */
protected $config;
/** @var OutputFormatterInterface */
protected $formatter;
/**
- * @param IConfig $config
+ * @param ?IConfig $config
* @param OutputFormatterInterface $formatter
*/
- public function __construct(IConfig $config, OutputFormatterInterface $formatter) {
+ public function __construct(?IConfig $config, OutputFormatterInterface $formatter) {
$this->config = $config;
$this->formatter = $formatter;
}
@@ -104,11 +104,16 @@ class TimestampFormatter implements OutputFormatterInterface {
return $this->formatter->format($message);
}
- $timeZone = $this->config->getSystemValue('logtimezone', 'UTC');
- $timeZone = $timeZone !== null ? new \DateTimeZone($timeZone) : null;
+ if ($this->config instanceof IConfig) {
+ $timeZone = $this->config->getSystemValue('logtimezone', 'UTC');
+ $timeZone = $timeZone !== null ? new \DateTimeZone($timeZone) : null;
- $time = new \DateTime('now', $timeZone);
- $timestampInfo = $time->format($this->config->getSystemValue('logdateformat', \DateTimeInterface::ATOM));
+ $time = new \DateTime('now', $timeZone);
+ $timestampInfo = $time->format($this->config->getSystemValue('logdateformat', \DateTimeInterface::ATOM));
+ } else {
+ $time = new \DateTime('now');
+ $timestampInfo = $time->format(\DateTimeInterface::ATOM);
+ }
return $timestampInfo . ' ' . $this->formatter->format($message);
}