ownDynDNS - Self-hosted dynamic DNS php script for Speedport Smart 4 and netcup DNS API

git clone git://git.bcharge.de/ownDynDNS.git

About | Log | Files | Refs | License

commit eb34f44292f894d01f2f77c71a5e0bb2e51ab44b
parent b551a2539103e0ef4eeaf166c781cacac03fc988
Author: Felix Kretschmer <felix.kretschmer@hubspace.de>
Date:   Thu, 16 May 2019 23:22:13 +0200

minimum improvements on major refoctoring of b2un0:
  - updated README.md to new filenames
  - added log.json creation if not existent in Handler.php

Diffstat:
MREADME.md | 6+++---
Msrc/Handler.php | 6++++++
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git 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: `<host record that is supposed to be updated>` -* Username: `<username as defined in update.php>` -* Password: `<password as definied in update.php>` +* Username: `<username as defined in .env file>` +* Password: `<password as definied in .env file>` # 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 -&copy; Felix Kretschmer, 2018 +&copy; Felix Kretschmer, 2019 diff --git 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));