summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole/rest/repository.php
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2017-10-16 16:13:59 +0000
committerramon <ramongomez@us.es>2017-10-16 16:13:59 +0000
commitd610135c9b6ee43d13bce5e5b6e4ce51c59a3648 (patch)
tree49dfaaf3a3b39f4741a559322060113587fd7e56 /admin/WebConsole/rest/repository.php
parent4073d146fec96ca89608a8e54ca2a6e5a25332ae (diff)
#810: Convertir datos a bytes para ruta REST {{{/repository/images}}}; propiedades de repositorio convierte tamaƱos a valor legible.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5463 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/WebConsole/rest/repository.php')
-rw-r--r--admin/WebConsole/rest/repository.php13
1 files changed, 2 insertions, 11 deletions
diff --git a/admin/WebConsole/rest/repository.php b/admin/WebConsole/rest/repository.php
index 3acb4230..c8288a98 100644
--- a/admin/WebConsole/rest/repository.php
+++ b/admin/WebConsole/rest/repository.php
@@ -64,13 +64,6 @@ function commandExist($cmd) {
return (empty($returnVal) ? false : true);
}
-function humanSize($bytes)
-{
- $si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
- $base = 1024;
- $class = min((int)log($bytes , $base) , count($si_prefix) - 1);
- return sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class];
-}
// Define REST routes.
@@ -118,10 +111,8 @@ $app->get('/repository/images(/)', 'validateRepositoryApiKey',
// Retrieve disk information.
$total = disk_total_space($imgPath);
$free = disk_free_space($imgPath);
- $response['disk']['total'] = humanSize($total);
- $response['disk']['used'] = humanSize($total - $free);
- $response['disk']['free'] = humanSize($free);
- $response['disk']['percent'] = 100 - floor(100 * $free / $total) . " %";
+ $response['disk']['total'] = $total;
+ $response['disk']['free'] = $free;
// JSON response.
jsonResponse(200, $response);
} else {