convert service_controls.php system_controls.php
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
$home = trim(shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"));
|
require_once "scripts/common.php";
|
||||||
|
$home = get_home();
|
||||||
|
|
||||||
function do_service_mount($action) {
|
function do_service_mount($action) {
|
||||||
echo "value=\"sudo systemctl ".$action." ".service_mount()." && sudo reboot\"";
|
echo "value=\"sudo systemctl ".$action." ".get_service_mount_name()." && sudo reboot\"";
|
||||||
}
|
}
|
||||||
function service_status($name) {
|
function service_status($name) {
|
||||||
global $home;
|
global $home;
|
||||||
@@ -81,7 +83,7 @@ function service_status($name) {
|
|||||||
<button type="submit" name="submit" value="sudo systemctl enable --now spectrogram_viewer.service">Enable</button>
|
<button type="submit" name="submit" value="sudo systemctl enable --now spectrogram_viewer.service">Enable</button>
|
||||||
</form>
|
</form>
|
||||||
<form action="" method="GET">
|
<form action="" method="GET">
|
||||||
<h3>Ram drive (!experimental!) <?php echo service_status(service_mount());?></h3>
|
<h3>Ram drive (!experimental!) <?php echo service_status(get_service_mount_name());?></h3>
|
||||||
<button type="submit" name="submit" <?php do_service_mount("disable");?> onclick="return confirm('This will reboot, are you sure?')">Disable</button>
|
<button type="submit" name="submit" <?php do_service_mount("disable");?> onclick="return confirm('This will reboot, are you sure?')">Disable</button>
|
||||||
<button type="submit" name="submit" <?php do_service_mount("enable");?> onclick="return confirm('This will reboot, are you sure?')">Enable</button>
|
<button type="submit" name="submit" <?php do_service_mount("enable");?> onclick="return confirm('This will reboot, are you sure?')">Enable</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
+3
-8
@@ -8,6 +8,7 @@ ini_set('user_agent', 'PHP_Flickr/1.0');
|
|||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
require_once 'scripts/common.php';
|
require_once 'scripts/common.php';
|
||||||
|
$home = get_home();
|
||||||
|
|
||||||
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_READONLY);
|
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_READONLY);
|
||||||
$db->busyTimeout(1000);
|
$db->busyTimeout(1000);
|
||||||
@@ -41,9 +42,6 @@ if(isset($_GET['species'])){
|
|||||||
$result3 = $statement3->execute();
|
$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) {
|
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", "");
|
||||||
file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "##start\n##end\n");
|
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();
|
ob_flush();
|
||||||
flush();
|
flush();
|
||||||
if (file_exists('./scripts/thisrun.txt')) {
|
$config = get_config();
|
||||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
|
||||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
|
||||||
$config = parse_ini_file('./scripts/firstrun.ini');
|
|
||||||
}
|
|
||||||
if (! empty($config["FLICKR_API_KEY"])) {
|
if (! empty($config["FLICKR_API_KEY"])) {
|
||||||
// only open the file once per script execution
|
// only open the file once per script execution
|
||||||
if(!isset($lines)) {
|
if(!isset($lines)) {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
require_once "scripts/common.php";
|
||||||
$user = trim($user);
|
$user = get_user();
|
||||||
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
$home = get_home();
|
||||||
$home = trim($home);
|
|
||||||
$fetch = shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi fetch 2>&1");
|
$fetch = shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi fetch 2>&1");
|
||||||
$str = trim(shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi status"));
|
$str = trim(shell_exec("sudo -u".$user." git -C ".$home."/BirdNET-Pi status"));
|
||||||
if (preg_match("/behind '.*?' by (\d+) commit(s?)\b/", $str, $matches)) {
|
if (preg_match("/behind '.*?' by (\d+) commit(s?)\b/", $str, $matches)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user