1
0
Fork 0
mirror of https://github.com/fernwerker/ownDynDNS.git synced 2025-07-10 14:15:14 +02:00

if log=false don't require logfile

This commit is contained in:
Nils Blume 2023-08-31 09:49:17 +02:00
parent c681a763b5
commit 058a32533b
2 changed files with 22 additions and 10 deletions

View file

@ -113,7 +113,15 @@ final class Config
$this->isAllowNetcupCreds() $this->isAllowNetcupCreds()
) )
) && ) &&
!empty($this->logFile); (
(
$this->isLog() &&
!empty($this->logFile)
) ||
(
$this->isLog() == false
)
);
} }
/** /**

View file

@ -92,10 +92,12 @@ final class Handler
$this->apipassword = $this->config->getApiPassword(); $this->apipassword = $this->config->getApiPassword();
} }
if (is_readable($this->config->getLogFile())) { if ($this->config->isLog()) {
$this->log = json_decode(file_get_contents($this->config->getLogFile()), true); if (is_readable($this->config->getLogFile())) {
} else { $this->log = json_decode(file_get_contents($this->config->getLogFile()), true);
$this->log[$this->payload->getDomain()] = []; } else {
$this->log[$this->payload->getDomain()] = [];
}
} }
} }
@ -111,13 +113,15 @@ final class Handler
*/ */
private function doLog($msg) private function doLog($msg)
{ {
$this->log[$this->payload->getDomain()][] = sprintf('[%s] %s', date('c'), $msg); if ($this->config->isLog()) {
$this->log[$this->payload->getDomain()][] = sprintf('[%s] %s', date('c'), $msg);
if ($this->config->isDebug()) { if ($this->config->isDebug()) {
printf('[DEBUG] %s %s', $msg, PHP_EOL); printf('[DEBUG] %s %s', $msg, PHP_EOL);
}
return $this;
} }
return $this;
} }
private function doExit() private function doExit()