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()
)
) &&
!empty($this->logFile);
(
(
$this->isLog() &&
!empty($this->logFile)
) ||
(
$this->isLog() == false
)
);
}
/**

View file

@ -92,12 +92,14 @@ final class Handler
$this->apipassword = $this->config->getApiPassword();
}
if ($this->config->isLog()) {
if (is_readable($this->config->getLogFile())) {
$this->log = json_decode(file_get_contents($this->config->getLogFile()), true);
} else {
$this->log[$this->payload->getDomain()] = [];
}
}
}
public function __destruct()
{
@ -111,6 +113,7 @@ final class Handler
*/
private function doLog($msg)
{
if ($this->config->isLog()) {
$this->log[$this->payload->getDomain()][] = sprintf('[%s] %s', date('c'), $msg);
if ($this->config->isDebug()) {
@ -119,6 +122,7 @@ final class Handler
return $this;
}
}
private function doExit()
{