Quellcode durchsuchen

Update functions.php

FusionPBX vor 5 Jahren
Ursprung
Commit
628839227a
1 geänderte Dateien mit 14 neuen und 0 gelöschten Zeilen
  1. 14 0
      resources/functions.php

+ 14 - 0
resources/functions.php

@@ -2091,4 +2091,18 @@ function number_pad($number,$n) {
 		}
 		}
 	}
 	}
 
 
+//convert bytes to readable human format
+	if (!function_exists('byte_convert')) {
+		function byte_convert($bytes, $precision = 2) {
+			static $units = array('B','KB','MB','GB','TB','PB','EB','ZB','YB');
+			$step = 1024;
+			$i = 0;
+			while (($bytes / $step) > 0.9) {
+				$bytes = $bytes / $step;
+				$i++;
+			}
+			return round($bytes, $precision).' '.$units[$i];
+		}
+	}
+
 ?>
 ?>