Commit 934b3989 authored by Kjartan's avatar Kjartan
Browse files

- moved format_size() from file.module to common.inc.

parent ed6cbd49
......@@ -116,6 +116,19 @@ function format_plural($count, $singular, $plural) {
return ($count == 1) ? "$count ". t($singular) : "$count ". t($plural);
}
function format_size($size) {
$suffix = "bytes";
if ($size > 1024) {
$size = round($size / 1024, 2);
$suffix = "KB";
}
if ($size > 1024) {
$size = round($size / 1024, 2);
$suffix = "MB";
}
return "$size $suffix";
}
function cache_clear($interval = 0) {
db_query("DELETE FROM cache WHERE ". time() ." - timestamp > $interval");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment