-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
Hello,
PFSense 24.11 removes the PHP smart code. This is a copied code snip from 23.09 util.php i believe, i have manually added it to my file but this will require some sort of fix for the new versions.
This code below is a terrible workaround that checks for a duplicate function if used on 23.09 and seems to work on my 24.11, sorry my ability is limited.
/* Locate disks that can be queried for S.M.A.R.T. data. */
if (!function_exists('get_smart_drive_list')) {
function get_smart_drive_list() {
/* SMART supports some disks directly, and some controllers directly,
* See https://redmine.pfsense.org/issues/9042 */
$supported_disk_types = array("ad", "da", "ada");
$supported_controller_types = array("nvme");
$disk_list = explode(" ", get_single_sysctl("kern.disks"));
foreach ($disk_list as $id => $disk) {
// We only want certain kinds of disks for S.M.A.R.T.
// 1 is a match, 0 is no match, False is any problem processing the regex
if (preg_match("/^(" . implode("|", $supported_disk_types) . ").*[0-9]{1,2}$/", $disk) !== 1) {
unset($disk_list[$id]);
continue;
}
}
foreach ($supported_controller_types as $controller) {
$devices = glob("/dev/{$controller}*");
if (!is_array($devices)) {
continue;
}
foreach ($devices as $device) {
$disk_list[] = basename($device);
}
}
sort($disk_list);
return $disk_list;
}
}
kozdroable and torygg
Metadata
Metadata
Assignees
Labels
No labels