Show time since last update of gravity.list when hovering the "Domains on Blocklist" on the dashboard

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2017-09-23 12:44:07 +02:00
parent 2e6adda93f
commit 84db04e51e
+18 -1
View File
@@ -48,10 +48,27 @@
</div>
</div>
</div>
<?php
$gravitylist = "/etc/pihole/gravity.list";
if (file_exists($gravitylist))
{
$gravitydiff = date_diff(date_create("@".filemtime($gravitylist)),date_create("now"));
if($gravitydiff->d > 1)
$gravitydate = $gravitydiff->format("Blocking list updated %a days, %H:%I ago");
elseif($gravitydiff->d == 1)
$gravitydate = $gravitydiff->format("Blocking list updated one day, %H:%I ago");
else
$gravitydate = $gravitydiff->format("Blocking list updated %H:%I ago");
}
else
{
$gravitydate = "Blocking list not found";
}
?>
<!-- ./col -->
<div class="col-lg-3 col-xs-12">
<!-- small box -->
<div class="small-box bg-red">
<div class="small-box bg-red" title="<?php echo $gravitydate; ?>">
<div class="inner">
<p>Domains on Blocklist</p>
<h3 class="statistic"><span id="domains_being_blocked">---</span></h3>