Create api.usage.php
This commit is contained in:
parent
50bad9debc
commit
67530dc53f
27
route/api.usage.php
Normal file
27
route/api.usage.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
loadHelper("exectool");
|
||||
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"data" => array()
|
||||
);
|
||||
|
||||
$directories = array(
|
||||
"/home2/hosting_users/easysys/"
|
||||
);
|
||||
|
||||
foreach($directories as $dir) {
|
||||
$cmd = sprintf("du -Ss %s", $dir);
|
||||
$output = exec_command($cmd, "shell_exec");
|
||||
|
||||
$terms = explode("\t", $output);
|
||||
$size = intval($terms[0]);
|
||||
|
||||
$result['data'] = array(
|
||||
"directory" => $dir,
|
||||
"size" => $size
|
||||
);
|
||||
}
|
||||
|
||||
set_header_content_type("json");
|
||||
echo json_encode($result);
|
Loading…
Reference in New Issue
Block a user