Commit 2418bc31 authored by David Morley's avatar David Morley

cleaner lookups, utf8 does not seem needed to fix now, something to watch still in dev

parent 0d352583
......@@ -15,6 +15,7 @@
* Use the git API for release versions, check development releases on pods https://github.com/diasporg/Poduptime/issues/143
* Forbid access to files that should be cli only https://github.com/diasporg/Poduptime/issues/152
* Move from bower to yarn for packages
* NOTE config.php.examples change to full paths for 2 items!
## End Users
* Show version and update in full view cleaner https://github.com/diasporg/Poduptime/issues/143
......
......@@ -5,10 +5,10 @@
declare(strict_types=1);
//backup directory - app directory path
//backup directory - full dir path
$backup_dir = '/backup';
//log directory - app directory path
//log directory - full dir path
$log_dir = '/log';
//location of pg dump - full dir path
......@@ -32,11 +32,11 @@ $adminemail = '';
//DNS server for dnssec testing. 1.1.1.1 tests the best
$dnsserver = '';
//CA for curl to use - full path
//CA for curl to use - full file path
$cafullpath = '';
//Mapbox.com API key. https://www.mapbox.com/help/how-access-tokens-work/
$mapboxkey = '';
//GeoIp2 city database file in mmdb format - full path
//GeoIp2 city database file in mmdb format - full file path
$geoip2db = '';
\ No newline at end of file
......@@ -15,7 +15,7 @@ require_once __DIR__ . '/../config.php';
define('PODUPTIME', microtime(true));
$log = new Logging();
$log->lfile(__DIR__ . '/../' . $log_dir . '/add.log');
$log->lfile( $log_dir . '/add.log');
if (!($_domain = $_GET['domain'] ?? null)) {
$log->lwrite('no domain given');
die('no pod domain given');
......
......@@ -15,15 +15,15 @@ require_once __DIR__ . '/../config.php';
$keep = (60 * 60 * 6) * 1;
$dump_date = date('Ymd_Hs');
$file_name = __DIR__ . '/..' . $backup_dir . '/dump_' . $dump_date . '.sql';
$file_name = $backup_dir . '/dump_' . $dump_date . '.sql';
system("export PGPASSWORD=$pgpass && $pg_dump_dir/pg_dump --username=$pguser $pgdb >> $file_name");
echo "pg backup of $pgdb made";
$dirh = dir(__DIR__ . '/..' . $backup_dir);
$dirh = dir($backup_dir);
while ($entry = $dirh->read()) {
$old_file_time = (date('U') - $keep);
$file_created = filectime(__DIR__ . '/..' . "$backup_dir/$entry");
$file_created = filectime( "$backup_dir/$entry");
if ($file_created < $old_file_time && !is_dir($entry)) {
if (unlink(__DIR__ . '/..' . "$backup_dir/$entry")) {
if (unlink( "$backup_dir/$entry")) {
echo 'Cleaned up old backups';
}
}
......
......@@ -240,12 +240,12 @@ foreach ($pods as $pod) {
_debug('Iplookupv6', $iplookupv6, true);
$geo = $reader->city($ip);
$countryname = !empty($geo->country->name) ? iconv('UTF-8', 'UTF-8//IGNORE', $geo->country->name) : null;
$country = !empty($geo->country->isoCode) ? iconv('UTF-8', 'UTF-8//IGNORE', $geo->country->isoCode) : null;
$city = !empty($geo->city->name) ? iconv('UTF-8', 'UTF-8//IGNORE', $geo->city->name) : null;
$state = !empty($geo->mostSpecificSubdivision->name) ? iconv('UTF-8', 'UTF-8//IGNORE', $geo->mostSpecificSubdivision->name) : null;
$lat = !empty($geo->location->latitude) ? $geo->location->latitude : 0;
$long = !empty($geo->location->longitude) ? $geo->location->longitude : 0;
$countryname = $geo->country->name ?? null ?: 0;
$country = $geo->country->isoCode ?? null ?: 0;
$city = $geo->city->name ?? null ?: 0;
$state = $geo->mostSpecificSubdivision->name ?? null ?: 0;
$lat = $geo->location->latitude ?? null ?: 0;
$long = $geo->location->longitude ?? null ?: 0;
_debug('Location', json_encode($geo->raw), true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment