feat(functions): getDifference(), getPercentageUsed()
clean up variable definition a little bitmain
parent
3bad21bf42
commit
9b1d12835b
|
|
@ -10,31 +10,41 @@
|
||||||
<meta name="msapplication-TileColor" content="#00aba9">
|
<meta name="msapplication-TileColor" content="#00aba9">
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
<?php
|
<?php
|
||||||
|
function getPercentageUsed($total, $used) {
|
||||||
|
return ($total && $used ?
|
||||||
|
sprintf('%.4f', (100 * $used / $total))
|
||||||
|
: false);
|
||||||
|
}
|
||||||
|
function getDifference($minuend, $subtrahend) {
|
||||||
|
return ($minuend && $subtrahend ?
|
||||||
|
$minuend - $subtrahend
|
||||||
|
: false);
|
||||||
|
}
|
||||||
$hinamizawa_total = disk_total_space(/data/);
|
$hinamizawa_total = disk_total_space(/data/);
|
||||||
$hinamizawa_free = disk_free_space(/data/);
|
$hinamizawa_free = disk_free_space(/data/);
|
||||||
$hinamizawa_percent_used = $hinamizawa_total ?
|
$hinamizawa_used = getDifference($hinamizawa_total, $hinamizawa_free);
|
||||||
(($hinamizawa_total - $hinamizawa_free) / $hinamizawa_total)
|
$hinamizawa_percent =
|
||||||
: false;
|
getPercentageUsed($hinamizawa_total, $hinamizawa_used);
|
||||||
$maebara_total = disk_total_space(/data/maebara/);
|
$maebara_total = disk_total_space(/data/maebara/);
|
||||||
$maebara_free = disk_free_space(/data/maebara/);
|
$maebara_free = disk_free_space(/data/maebara/);
|
||||||
$maebara_percent_used = $maebara_total ?
|
$maebara_used = getDifference($maebara_total, $maebara_free);
|
||||||
(($maebara_total - $maebara_free) / $maebara_total)
|
$maebara_percent =
|
||||||
: false;
|
getPercentageUsed($maebara_total, $maebara_used);
|
||||||
$houjou_total = disk_total_space(/data/houjou/);
|
$houjou_total = disk_total_space(/data/houjou/);
|
||||||
$houjou_free = disk_free_space(/data/houjou/);
|
$houjou_free = disk_free_space(/data/houjou/);
|
||||||
$houjou_percent_used = $houjou_total ?
|
$houjou_used = getDifference($houjou_total, $houjou_free);
|
||||||
(($houjou_total - $houjou_free) / $houjou_total)
|
$houjou_percent =
|
||||||
: false;
|
getPercentageUsed($houjou_total, $houjou_used);
|
||||||
$ryuuguu_total = disk_total_space(/data/ryuuguu/);
|
$ryuuguu_total = disk_total_space(/data/ryuuguu/);
|
||||||
$ryuuguu_free = disk_free_space(/data/ryuuguu/);
|
$ryuuguu_free = disk_free_space(/data/ryuuguu/);
|
||||||
$ryuuguu_percent_used = $ryuuguu_total ?
|
$ryuuguu_used = getDifference($ryuuguu_total, $ryuuguu_free);
|
||||||
(($ryuuguu_total - $ryuuguu_free) / $ryuuguu_total)
|
$ryuuguu_percent =
|
||||||
: false;
|
getPercentageUsed($ryuuguu_total, $ryuuguu_used);
|
||||||
$sonozaki_total = disk_total_space(/data/sonozaki/);
|
$sonozaki_total = disk_total_space(/data/sonozaki/);
|
||||||
$sonozaki_free = disk_free_space(/data/sonozaki/);
|
$sonozaki_free = disk_free_space(/data/sonozaki/);
|
||||||
$sonozaki_percent_used = $sonozaki_total
|
$sonozaki_used = getDifference($sonozaki_total, $sonozaki_free);
|
||||||
(($sonozaki_total - $sonozaki_free) / $sonozaki_total)
|
$sonozaki_percent =
|
||||||
: false;
|
getPercentageUsed($sonozaki_total, $sonozaki_used);
|
||||||
?>
|
?>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.pie {
|
.pie {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue