1
0
Fork 0
mirror of https://github.com/fernwerker/ownDynDNS.git synced 2025-07-10 06:05:13 +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,10 +92,12 @@ final class Handler
$this->apipassword = $this->config->getApiPassword();
}
if (is_readable($this->config->getLogFile())) {
$this->log = json_decode(file_get_contents($this->config->getLogFile()), true);
} else {
$this->log[$this->payload->getDomain()] = [];
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()] = [];
}
}
}
@ -111,13 +113,15 @@ final class Handler
*/
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()) {
printf('[DEBUG] %s %s', $msg, PHP_EOL);
if ($this->config->isDebug()) {
printf('[DEBUG] %s %s', $msg, PHP_EOL);
}
return $this;
}
return $this;
}
private function doExit()