From 20705a550df5b13a544dc0865c6aef16e64c99d9 Mon Sep 17 00:00:00 2001 From: ShevAbam Date: Wed, 18 Jun 2014 10:11:11 +0200 Subject: + First commit (version 2.0) --- libs/disk.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 libs/disk.php (limited to 'libs/disk.php') diff --git a/libs/disk.php b/libs/disk.php new file mode 100644 index 0000000..d3d3199 --- /dev/null +++ b/libs/disk.php @@ -0,0 +1,49 @@ + 'N.A', + 'used' => 'N.A', + 'free' => 'N.A', + 'percent_used' => 0, + 'mount' => 'N.A', + ); +} +else +{ + $first_line = false; + + $mounted_points = array(); + + foreach ($df as $mounted) + { + if ($first_line === false) + { + $first_line = true; + continue; + } + + list($total, $used, $free, $percent, $mount) = explode(',', $mounted); + + if (!in_array($mount, $mounted_points)) + { + $mounted_points[] = trim($mount); + + $datas[] = array( + 'total' => Misc::getSize($total * 1024), + 'used' => Misc::getSize($used * 1024), + 'free' => Misc::getSize($free * 1024), + 'percent_used' => trim($percent, '%'), + 'mount' => $mount, + ); + } + } + +} + + +echo json_encode($datas); \ No newline at end of file -- cgit v1.3