parent
b4781a77a6
commit
66233b6984
|
|
@ -23,6 +23,47 @@
|
||||||
text-shadow: 1px 1px #000;
|
text-shadow: 1px 1px #000;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
function getByteString($bytes) {
|
||||||
|
$symbol = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||||
|
$exp = ($bytes ? floor(log($bytes)/log(1024)) : 0);
|
||||||
|
return sprintf(
|
||||||
|
'%.2f '.$symbol[$exp],
|
||||||
|
($bytes ? $bytes/pow(1024, floor($exp)) : 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function getPercentageUsed($total, $used) {
|
||||||
|
return ($total && $used ?
|
||||||
|
sprintf('%.4f', (100 * $used / $total))
|
||||||
|
: false);
|
||||||
|
}
|
||||||
|
function getDifference($minuend, $subtrahend) {
|
||||||
|
return ($minuend && $subtrahend ?
|
||||||
|
$minuend - $subtrahend
|
||||||
|
: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$keepall_total = disk_total_space("/Volumes/Keepall/");
|
||||||
|
$keepall_free = disk_free_space("/Volumes/Keepall/");
|
||||||
|
$keepall_used = getDifference($keepall_total, $keepall_free);
|
||||||
|
$keepall_percent = getPercentageUsed($keepall_total, $keepall_used);
|
||||||
|
|
||||||
|
$neverfull_total = disk_total_space("/Volumes/Neverfull/");
|
||||||
|
$neverfull_free = disk_free_space("/Volumes/Neverfull/");
|
||||||
|
$neverfull_used = getDifference($neverfull_total, $neverfull_free);
|
||||||
|
$neverfull_percent = getPercentageUsed($neverfull_total, $neverfull_used);
|
||||||
|
|
||||||
|
$speedy_total = disk_total_space("/Volumes/Speedy/");
|
||||||
|
$speedy_free = disk_free_space("/Volumes/Speedy/");
|
||||||
|
$speedy_used = getDifference($speedy_total, $speedy_free);
|
||||||
|
$speedy_percent = getPercentageUsed($speedy_total, $speedy_used);
|
||||||
|
|
||||||
|
$pochette_total = disk_total_space("/Volumes/Pochette/");
|
||||||
|
$pochette_free = disk_free_space("/Volumes/Pochette/");
|
||||||
|
$pochette_used = getDifference($pochette_total, $pochette_free);
|
||||||
|
$pochette_percent = getPercentageUsed($pochette_total, $pochette_used);
|
||||||
|
?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
@ -34,15 +75,63 @@
|
||||||
<h2>Luggage</h2>
|
<h2>Luggage</h2>
|
||||||
<div class="luggage">
|
<div class="luggage">
|
||||||
<h3>Keepall</h3>
|
<h3>Keepall</h3>
|
||||||
|
<svg height="20" width="20" viewBox="0 0 20 20">
|
||||||
|
<circle r="10" cx="10" cy="10" fill="#e6ddcc" />
|
||||||
|
<circle r="5" cx="10" cy="10" fill="transparent"
|
||||||
|
stroke="#312c4c"
|
||||||
|
stroke-width="10"
|
||||||
|
stroke-dasharray="<?php echo ($keepall_percent ?
|
||||||
|
$keepall_percent : 0) * 31.4 / 100;?> 31.4"
|
||||||
|
transform="rotate(-90) translate(-20)"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<h4><em>Free Space:</em> <?php echo getByteString($keepall_free);?></h4>
|
||||||
|
<h4><em>Used Space:</em> <?php echo getByteString($keepall_used);?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="luggage">
|
<div class="luggage">
|
||||||
<h3>Neverfull</h3>
|
<h3>Neverfull</h3>
|
||||||
|
<svg height="20" width="20" viewBox="0 0 20 20">
|
||||||
|
<circle r="10" cx="10" cy="10" fill="#e6ddcc" />
|
||||||
|
<circle r="5" cx="10" cy="10" fill="transparent"
|
||||||
|
stroke="#312c4c"
|
||||||
|
stroke-width="10"
|
||||||
|
stroke-dasharray="<?php echo ($neverfull_percent ?
|
||||||
|
$neverfull_percent : 0) * 31.4 / 100;?> 31.4"
|
||||||
|
transform="rotate(-90) translate(-20)"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<h4><em>Free Space:</em> <?php echo getByteString($neverfull_free);?></h4>
|
||||||
|
<h4><em>Used Space:</em> <?php echo getByteString($neverfull_used);?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="luggage">
|
<div class="luggage">
|
||||||
<h3>Speedy</h3>
|
<h3>Speedy</h3>
|
||||||
|
<svg height="20" width="20" viewBox="0 0 20 20">
|
||||||
|
<circle r="10" cx="10" cy="10" fill="#e6ddcc" />
|
||||||
|
<circle r="5" cx="10" cy="10" fill="transparent"
|
||||||
|
stroke="#312c4c"
|
||||||
|
stroke-width="10"
|
||||||
|
stroke-dasharray="<?php echo ($speedy_percent ?
|
||||||
|
$speedy_percent : 0) * 31.4 / 100;?> 31.4"
|
||||||
|
transform="rotate(-90) translate(-20)"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<h4><em>Free Space:</em> <?php echo getByteString($speedy_free);?></h4>
|
||||||
|
<h4><em>Used Space:</em> <?php echo getByteString($speedy_used);?></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="luggage">
|
<div class="luggage">
|
||||||
<h3>Pochette</h3>
|
<h3>Pochette</h3>
|
||||||
|
<svg height="20" width="20" viewBox="0 0 20 20">
|
||||||
|
<circle r="10" cx="10" cy="10" fill="#e6ddcc" />
|
||||||
|
<circle r="5" cx="10" cy="10" fill="transparent"
|
||||||
|
stroke="#312c4c"
|
||||||
|
stroke-width="10"
|
||||||
|
stroke-dasharray="<?php echo ($pochette_percent ?
|
||||||
|
$pochette_percent : 0) * 31.4 / 100;?> 31.4"
|
||||||
|
transform="rotate(-90) translate(-20)"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<h4><em>Free Space:</em> <?php echo getByteString($pochette_free);?></h4>
|
||||||
|
<h4><em>Used Space:</em> <?php echo getByteString($pochette_used);?></h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue