diff --git a/api_speedtest.php b/api_speedtest.php index 6a61c2fc9..5d6f6c717 100644 --- a/api_speedtest.php +++ b/api_speedtest.php @@ -92,7 +92,7 @@ function getSpeedTestData($dbSpeedtest, $durationdays = '1') return array(); } $db = new SQLite3($dbSpeedtest); - if (!$db) { + if (!$db || !$db->querySingle('SELECT count(*) FROM sqlite_master WHERE type="table" AND name="speedtest"')) { return array(); } @@ -265,7 +265,11 @@ function JSONServers($cmdServersJSON) function getRemainingTime() { - $interval_seconds = speedtestExecute("grep 'interval_seconds=' /opt/pihole/speedtestmod/schedule_check.sh | cut -d'=' -f2")['data']; + $interval_seconds = -1; + + if (file_exists('/opt/pihole/speedtestmod/schedule_check.sh')) { + $interval_seconds = speedtestExecute("grep 'interval_seconds=' /opt/pihole/speedtestmod/schedule_check.sh | cut -d'=' -f2")['data']; + } // if interval_seconds is "nan", then schedule has never been set if (strpos($interval_seconds, 'nan') !== false) { @@ -296,7 +300,7 @@ function getRemainingTime() function getNumberOfDaysInDB($dbSpeedtest) { $db = new SQLite3($dbSpeedtest); - if (!$db) { + if (!$db || !$db->querySingle('SELECT count(*) FROM sqlite_master WHERE type="table" AND name="speedtest"')) { return array('data' => 0); } diff --git a/img/st-chart.png b/img/st-chart.png new file mode 100644 index 000000000..c038da224 Binary files /dev/null and b/img/st-chart.png differ diff --git a/img/st-pref.png b/img/st-pref.png new file mode 100644 index 000000000..e09fa940e Binary files /dev/null and b/img/st-pref.png differ diff --git a/scripts/pi-hole/php/header_authenticated.php b/scripts/pi-hole/php/header_authenticated.php index 1990795cf..1a66cbbdd 100644 --- a/scripts/pi-hole/php/header_authenticated.php +++ b/scripts/pi-hole/php/header_authenticated.php @@ -153,7 +153,7 @@ function getTemperature() function getNumberOfDaysInDB($dbSpeedtest) { $db = new SQLite3($dbSpeedtest); - if (!$db) { + if (!$db || !$db->querySingle('SELECT count(*) FROM sqlite_master WHERE type="table" AND name="speedtest"')) { return 0; }