diff --git a/scripts/service_controls.php b/scripts/service_controls.php index 555c804..410db17 100644 --- a/scripts/service_controls.php +++ b/scripts/service_controls.php @@ -1,7 +1,9 @@ Enable
-

Ram drive (!experimental!)

+

Ram drive (!experimental!)

diff --git a/scripts/stats.php b/scripts/stats.php index 831a8f0..84ae9f7 100644 --- a/scripts/stats.php +++ b/scripts/stats.php @@ -8,6 +8,7 @@ ini_set('user_agent', 'PHP_Flickr/1.0'); error_reporting(0); ini_set('display_errors', 0); require_once 'scripts/common.php'; +$home = get_home(); $db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_READONLY); $db->busyTimeout(1000); @@ -41,9 +42,6 @@ if(isset($_GET['species'])){ $result3 = $statement3->execute(); } -$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"); -$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); -$home = trim($home); if(!file_exists($home."/BirdNET-Pi/scripts/disk_check_exclude.txt") || strpos(file_get_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt"),"##start") === false) { file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", ""); file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "##start\n##end\n"); @@ -192,11 +190,8 @@ while($results=$result3->fetchArray(SQLITE3_ASSOC)){ ob_flush(); flush(); - if (file_exists('./scripts/thisrun.txt')) { - $config = parse_ini_file('./scripts/thisrun.txt'); - } elseif (file_exists('./scripts/firstrun.ini')) { - $config = parse_ini_file('./scripts/firstrun.ini'); - } + $config = get_config(); + if (! empty($config["FLICKR_API_KEY"])) { // only open the file once per script execution if(!isset($lines)) { diff --git a/scripts/system_controls.php b/scripts/system_controls.php index c63b2ac..8be7135 100644 --- a/scripts/system_controls.php +++ b/scripts/system_controls.php @@ -1,9 +1,9 @@ &1"); $str = trim(shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi status")); if (preg_match("/behind '.*?' by (\d+) commit(s?)\b/", $str, $matches)) {