Browse Source

compat size() func

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@144 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.1
Xuefer 15 years ago
parent
commit
ab1bf16c23
  1. 8
      admin/xcache.php

8
admin/xcache.php

@ -40,16 +40,16 @@ function number_formats($a, $keys)
return $a;
}
function size($size, $suffix = '', $precision = 2)
function size($size)
{
$size = (int) $size;
if ($size < 1024)
return number_format($size, $precision) . ' ' . $suffix;
return number_format($size, 2) . ' b';
if ($size < 1048576)
return number_format($size / 1024, $precision) . ' K' . $suffix;
return number_format($size / 1024, 2) . ' K';
return number_format($size / 1048576, $precision) . ' M' . $suffix;
return number_format($size / 1048576, 2) . ' M';
}
function age($time)

Loading…
Cancel
Save