If behind by more than 50 commits, show update badge on "Tools"

This commit is contained in:
ehpersonal38
2022-05-27 15:32:43 -04:00
parent 0187cc2c45
commit 201f705517
3 changed files with 27 additions and 9 deletions
+1 -7
View File
@@ -1,9 +1,3 @@
<?php
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
$home = trim($home);
$behind = trim(shell_exec("sudo git -C ".$home."/BirdNET-Pi fetch > /dev/null 2>&1 && git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7"));
?>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<br>
@@ -13,7 +7,7 @@ $behind = trim(shell_exec("sudo git -C ".$home."/BirdNET-Pi fetch > /dev/null 2>
<button type="submit" name="submit" value="sudo reboot" onclick="return confirm('Are you sure you want to reboot?')">Reboot</button>
</form>
<form action="" method="GET">
<button type="submit" name="submit" value="update_birdnet.sh" onclick="return confirm('Are you sure you want to update?')">Update <?php if($behind != "0" && $behind != "with"){?><div class="updatenumber"><?php echo $behind; ?></div><?php } ?></button>
<button type="submit" name="submit" value="update_birdnet.sh" onclick="return confirm('Are you sure you want to update?')">Update <?php if($_SESSION['behind'] != "0" && $_SESSION['behind'] != "with"){?><div class="updatenumber"><?php echo $_SESSION['behind']; ?></div><?php } ?></button>
</form>
<form action="" method="GET">
<button type="submit" name="submit" value="sudo shutdown now" onclick="return confirm('Are you sure you want to shutdown?')">Shutdown</button>