pts-core: PHP 8.5 warning fixes

This commit is contained in:
Michael Larabel
2025-11-30 04:42:41 -06:00
parent e8f464155b
commit f9fb12b6d2
7 changed files with 7 additions and 53 deletions

View File

@@ -1385,6 +1385,7 @@ class phodevi_cpu extends phodevi_device_interface
162 => 'Zen 4', 162 => 'Zen 4',
163 => 'Zen 4', 163 => 'Zen 4',
164 => 'Zen 4', 164 => 'Zen 4',
128 => 'Zen 4',
165 => 'Zen 4', 165 => 'Zen 4',
166 => 'Zen 4', 166 => 'Zen 4',
167 => 'Zen 4', 167 => 'Zen 4',

View File

@@ -583,7 +583,7 @@ class pts_strings
public static function result_quantifier_to_string($quantifier) public static function result_quantifier_to_string($quantifier)
{ {
$quantifiers = array('MAX' => 'Maximum', 'MIN' => 'Minimum', 'NULL' => null, 'AVG' => 'Average'); $quantifiers = array('MAX' => 'Maximum', 'MIN' => 'Minimum', 'NULL' => null, 'AVG' => 'Average');
return isset($quantifiers[$quantifier]) ? $quantifiers[$quantifier] : 'Average'; return !empty($quantifier) && isset($quantifiers[$quantifier]) ? $quantifiers[$quantifier] : 'Average';
} }
public static function format_time($time, $input_format = 'SECONDS', $standard_version = true, $round_to = 0) public static function format_time($time, $input_format = 'SECONDS', $standard_version = true, $round_to = 0)
{ {

View File

@@ -43,6 +43,7 @@ class phoromatic_maintenance_table implements pts_webui_interface
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Hardware, Software, ClientVersion, LastIP, NetworkMAC, LastCommunication, CurrentTask, CoreVersion, NetworkWakeOnLAN, BlockPowerOffs FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY LastCommunication DESC'); $stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Hardware, Software, ClientVersion, LastIP, NetworkMAC, LastCommunication, CurrentTask, CoreVersion, NetworkWakeOnLAN, BlockPowerOffs FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY LastCommunication DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute(); $result = $stmt->execute();
$components = array();
while($row = $result->fetchArray()) while($row = $result->fetchArray())
{ {

View File

@@ -40,6 +40,7 @@ class phoromatic_sched implements pts_webui_interface
return; return;
$is_new = true; $is_new = true;
$e_schedule = array();
$env_var_edit = array(); $env_var_edit = array();
if(!empty($PATH[0]) && is_numeric($PATH[0])) if(!empty($PATH[0]) && is_numeric($PATH[0]))
{ {

View File

@@ -60,57 +60,6 @@ class phoromatic_tests implements pts_webui_interface
{ {
$main .= '<p>No results found on this Phoromatic Server for the ' . $tp->get_title() . ' test profile.</p>'; $main .= '<p>No results found on this Phoromatic Server for the ' . $tp->get_title() . ' test profile.</p>';
} }
else if(false) // previously: $recent_result_count > 5 TODO broken
{
// TODO XXX below code is borked
$stmt = phoromatic_server::$db->prepare('SELECT UploadID, SystemID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND UploadID IN (SELECT DISTINCT UploadID FROM phoromatic_results_results WHERE AccountID = :account_id AND TestProfile LIKE :tp) ORDER BY UploadTime DESC LIMIT 1000');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':tp', $tp_identifier . '%');
$result = $stmt->execute();
$recent_result_count = 0;
$result_file = new pts_result_file(null, true);
while($result && $row = $result->fetchArray())
{
$composite_xml = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'composite.xml';
if(!is_file($composite_xml))
{
continue;
}
// Add to result file
$system_name = strtotime($row['UploadTime']) . ': ' . phoromatic_server::system_id_to_name($row['SystemID']);
$sub_result_file = new pts_result_file($composite_xml, true);
foreach($sub_result_file->get_result_objects() as $obj)
{
if($obj->test_profile->get_identifier(false) == $tp_identifier)
{
$obj->test_result_buffer->rename(null, $system_name);
$result_file->add_result($obj);
}
}
}
$table = null;
$extra_attributes = array('multi_way_comparison_invert_default' => false);
$f = false;
foreach($result_file->get_result_objects() as $obj)
{
$obj->test_profile->set_display_format('SCATTER_PLOT');
foreach($obj->test_result_buffer->buffer_items as $i => &$item)
{
if(!is_numeric(substr($item->get_result_identifier(), 0, strpos($item->get_result_identifier(), ':'))))
{
unset($obj->test_result_buffer->buffer_items[$i]);
}
}
$result_file = null;
$main .= '<p align="center">' . pts_render::render_graph_inline_embed($obj, $result_file, $extra_attributes) . '</p>';
}
}
} }
else else
{ {

View File

@@ -260,6 +260,7 @@ function phoromatic_tracker_page_relevant()
function phoromatic_webui_header_logged_in() function phoromatic_webui_header_logged_in()
{ {
$html_links = array(); $html_links = array();
$pages = array();
if($_SESSION['AdminLevel'] == -40) if($_SESSION['AdminLevel'] == -40)
{ {
$pages = array('Admin', 'Admin_Config', 'Admin_Data', 'Logout'); $pages = array('Admin', 'Admin_Config', 'Admin_Data', 'Logout');

View File

@@ -104,6 +104,7 @@ class pts_webui_tests implements pts_webui_interface
$tests_to_show = array_unique($tests_to_show); $tests_to_show = array_unique($tests_to_show);
usort($tests_to_show, array('pts_webui_tests', 'cmp_result_object_sort')); usort($tests_to_show, array('pts_webui_tests', 'cmp_result_object_sort'));
$category = null; $category = null;
$popularity_index = array();
foreach($tests_to_show as &$test_profile) foreach($tests_to_show as &$test_profile)
{ {
if($category != $test_profile->get_test_hardware_type()) if($category != $test_profile->get_test_hardware_type())
@@ -114,7 +115,7 @@ class pts_webui_tests implements pts_webui_interface
} }
$last_updated = pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'last_updated'); $last_updated = pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'last_updated');
$popularity = array_search($test_profile->get_identifier(false), $popularity_index); $popularity = !empty($popularity_index) ? array_search($test_profile->get_identifier(false), $popularity_index) : 9999;
$secondary_message = null; $secondary_message = null;
if($last_updated > (time() - (60 * 60 * 24 * 21))) if($last_updated > (time() - (60 * 60 * 24 * 21)))