diff --git a/README.md b/README.md index 1c58bb7..1812d00 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ Self-hosted dynamic DNS php script to update netcup DNS API from Router like AVM * only the url needs to be adjusted, the rest is automatically filled by your AVM FRITZ!Box * http or https is possible if valid SSL certificate (e.g. Let's Encrypt) * Domainname: `` -* Username: `` -* Password: `` +* Username: `` +* Password: `` # run as cronjob on a **nix based device * see [examples](./examples) @@ -38,4 +38,4 @@ Self-hosted dynamic DNS php script to update netcup DNS API from Router like AVM ## License Published under GNU General Public License v3.0 -© Felix Kretschmer, 2018 +© Felix Kretschmer, 2019 diff --git a/src/Handler.php b/src/Handler.php index ec93c7d..ff12360 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -75,6 +75,12 @@ final class Handler if (!$this->config->isLog()) { return; } + + if (!file_exists($this->config->getLogFile())) { + if (!touch($this->config->getLogFile())) { + printf('[ERROR] unable to create %s %s', $this->config->getLogFile(), PHP_EOL); + } + } // save only the newest 100 log entries for each domain $this->log[$this->payload->getDomain()] = array_reverse(array_slice(array_reverse($this->log[$this->payload->getDomain()]), 0, 100));