function get_all_disks_info($bus = "all") { unassigned_log("Starting get_all_disks_info.", "DEBUG"); $d1 = time(); $ud_disks = get_unasigned_disks(); foreach ($ud_disks as $key => $disk) { if ($disk['type'] != $bus && $bus != "all") { continue; } $disk['temperature'] = "*"; $disk['size'] = intval(trim(shell_exec("/sbin/blockdev --getsize64 {$key} 2>/dev/null"))); $disk = array_merge($disk, get_disk_info($key)); foreach ($disk['partitions'] as $k => $p) { if ($p) { $disk['partitions'][$k] = get_partition_info($p); } } $ud_disks[$key] = $disk; } unassigned_log("Total time: " . (time() - $d1) . "s", "DEBUG"); usort($ud_disks, create_function('$a, $b', '$key="device";if ($a[$key] == $b[$key]) return 0; return ($a[$key] < $b[$key]) ? -1 : 1;')); return $ud_disks; }
function get_all_disks_info($bus="all") { // $d1 = time(); $disks = get_unasigned_disks(); foreach ($disks as $key => $disk) { if ($disk['type'] != $bus && $bus != "all") continue; $disk['temperature'] = get_temp($key); $disk['size'] = intval(trim(shell_exec("blockdev --getsize64 ${key} 2>/dev/null"))); $disk = array_merge($disk, get_disk_info($key)); $disks[$key] = $disk; } // debug("get_all_disks_info: ".(time() - $d1)); usort($disks, create_function('$a, $b','$key="device";if ($a[$key] == $b[$key]) return 0; return ($a[$key] < $b[$key]) ? -1 : 1;')); return $disks; }