pts-core: PHP warning fixes and other random fixes
This commit is contained in:
@@ -33,6 +33,7 @@ class list_available_suites implements pts_option_interface
|
||||
{
|
||||
$available_suites = pts_test_suites::all_suites(true, true);
|
||||
pts_client::$display->generic_heading('Available Suites');
|
||||
$suites = array();
|
||||
|
||||
if(count($available_suites) > 0)
|
||||
{
|
||||
@@ -53,14 +54,14 @@ class list_available_suites implements pts_option_interface
|
||||
|
||||
if($suite_info->get_title() != null && !$suite_info->is_deprecated())
|
||||
{
|
||||
echo sprintf('%-34ls - %-32ls %s' . PHP_EOL, $identifier_prefix . ' ' . $identifier, $suite_info->get_title(), $suite_info->get_suite_type());
|
||||
$suites[] = array($identifier_prefix . ' ' . $identifier, pts_client::cli_just_bold($suite_info->get_title()), $suite_info->get_suite_type());
|
||||
}
|
||||
}
|
||||
}
|
||||
echo PHP_EOL;
|
||||
echo pts_user_io::display_text_table($suites) . PHP_EOL . PHP_EOL;
|
||||
if($has_partially_supported_suite)
|
||||
{
|
||||
echo '* Indicates a partially supported suite.' . PHP_EOL . PHP_EOL;
|
||||
echo pts_client::cli_just_italic('* Indicates a partially supported suite.') . PHP_EOL;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -33,7 +33,7 @@ class list_failed_installs implements pts_option_interface
|
||||
{
|
||||
foreach($failed_installs as $test_profile)
|
||||
{
|
||||
echo pts_client::cli_just_bold(sprintf('%-36ls - %-30ls' . PHP_EOL, $test_profile->get_identifier(), $test_profile->get_title()));
|
||||
echo pts_client::cli_just_bold(sprintf('%s-36ls - %s-30ls' . PHP_EOL, $test_profile->get_identifier(), $test_profile->get_title()));
|
||||
$install_errors = $test_profile->test_installation->get_install_errors();
|
||||
if(!empty($install_errors))
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
Phoronix Test Suite
|
||||
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
|
||||
Copyright (C) 2008 - 2016, Phoronix Media
|
||||
Copyright (C) 2008 - 2016, Michael Larabel
|
||||
Copyright (C) 2008 - 2024, Phoronix Media
|
||||
Copyright (C) 2008 - 2024, Michael Larabel
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -28,19 +28,21 @@ class list_installed_tests implements pts_option_interface
|
||||
public static function run($r)
|
||||
{
|
||||
$installed_tests = pts_tests::installed_tests(true);
|
||||
pts_client::$display->generic_heading(count($installed_tests) . ' Tests Installed');
|
||||
|
||||
if(count($installed_tests) > 0)
|
||||
{
|
||||
$installed = array();
|
||||
foreach($installed_tests as $test_profile)
|
||||
{
|
||||
$name = $test_profile->get_title();
|
||||
|
||||
if($name != false)
|
||||
{
|
||||
echo sprintf('%-36ls - %-30ls' . PHP_EOL, $test_profile->get_identifier(), $name);
|
||||
$installed[] = array($test_profile->get_identifier(), pts_client::cli_just_bold($name));
|
||||
}
|
||||
}
|
||||
pts_client::$display->generic_heading(count($installed) . ' Tests Installed');
|
||||
echo pts_user_io::display_text_table($installed) . PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
Phoronix Test Suite
|
||||
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
|
||||
Copyright (C) 2008 - 2011, Phoronix Media
|
||||
Copyright (C) 2008 - 2011, Michael Larabel
|
||||
Copyright (C) 2008 - 2024, Phoronix Media
|
||||
Copyright (C) 2008 - 2024, Michael Larabel
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -28,12 +28,13 @@ class list_modules implements pts_option_interface
|
||||
public static function run($r)
|
||||
{
|
||||
pts_client::$display->generic_heading(count(pts_module_manager::available_modules()) . ' Modules');
|
||||
|
||||
$modules = array();
|
||||
foreach(pts_module_manager::available_modules() as $module)
|
||||
{
|
||||
pts_module_manager::load_module($module);
|
||||
echo sprintf('%-22ls - %-32ls [%s]' . PHP_EOL, $module, pts_module_manager::module_call($module, 'module_name') . ' v' . pts_module_manager::module_call($module, 'module_version'), pts_module_manager::module_call($module, 'module_author'));
|
||||
$modules[] = array($module, pts_client::cli_just_bold(pts_module_manager::module_call($module, 'module_name')));
|
||||
}
|
||||
echo pts_user_io::display_text_table($modules) . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ class list_test_errors implements pts_option_interface
|
||||
$runtime_errors = $test_profile->test_installation->get_runtime_errors();
|
||||
if(!empty($runtime_errors))
|
||||
{
|
||||
echo pts_client::cli_just_bold(sprintf('%-36ls - %-30ls' . PHP_EOL, $test_profile->get_identifier(), $test_profile->get_title()));
|
||||
echo pts_client::cli_just_bold($test_profile->get_identifier()) . ': ' . $test_profile->get_title();
|
||||
foreach($runtime_errors as $e)
|
||||
{
|
||||
echo trim((empty($e['description']) ? '' : pts_client::cli_just_italic($e['description']) . ' - ') . $e['date_time']) . PHP_EOL;
|
||||
foreach($e['errors'] as $error)
|
||||
foreach(array_unique($e['errors']) as $error)
|
||||
{
|
||||
echo pts_client::cli_colored_text(' ' . $error, 'red', true) . PHP_EOL;
|
||||
}
|
||||
|
||||
@@ -31,14 +31,13 @@ class list_test_status implements pts_option_interface
|
||||
$status = $test_profile->test_installation->get_install_status();
|
||||
if($status == 'INSTALLED')
|
||||
{
|
||||
$status = pts_client::cli_colored_text($status, 'green', false);
|
||||
$status = pts_client::cli_colored_text($status . ' @ ' . $test_profile->test_installation->get_install_date(), 'green', false);
|
||||
}
|
||||
else if($status == 'INSTALL_FAILED')
|
||||
{
|
||||
$status = pts_client::cli_colored_text('INSTALL FAILED', 'red', true);
|
||||
}
|
||||
echo pts_client::cli_just_bold(sprintf('%-36ls %-20ls' . PHP_EOL, $test_profile->get_identifier(), $status));
|
||||
echo sprintf('%-36ls %-20ls' . PHP_EOL, 'Installed: ' . $test_profile->test_installation->get_install_date(), ($test_profile->test_installation->get_run_count() > 0 ? 'Times Run: ' . $test_profile->test_installation->get_run_count() : ''));
|
||||
echo pts_client::cli_just_bold($test_profile->get_identifier() . str_repeat(' ' , 32 - strlen($test_profile->get_identifier())) . $status) . ' ' . pts_strings::plural_handler($test_profile->test_installation->get_run_count(), 'Time') . ' Run' . PHP_EOL;
|
||||
$runtime_errors = $test_profile->test_installation->get_runtime_errors();
|
||||
$install_errors = $test_profile->test_installation->get_install_errors();
|
||||
if(!empty($runtime_errors))
|
||||
@@ -46,7 +45,7 @@ class list_test_status implements pts_option_interface
|
||||
foreach($runtime_errors as $e)
|
||||
{
|
||||
echo ' ' . trim((empty($e['description']) ? '' : pts_client::cli_just_italic($e['description']) . ' - ') . 'Last Attempted: ' . $e['date_time']) . PHP_EOL;
|
||||
foreach($e['errors'] as $error)
|
||||
foreach(array_unique($e['errors']) as $error)
|
||||
{
|
||||
echo pts_client::cli_colored_text(' ' . $error, 'red', true) . PHP_EOL;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class openbenchmarking_repositories implements pts_option_interface
|
||||
public static function run($r)
|
||||
{
|
||||
echo PHP_EOL . 'Linked OpenBenchmarking.org Repositories:' . PHP_EOL . PHP_EOL;
|
||||
$repos = array();
|
||||
foreach(pts_openbenchmarking::linked_repositories() as $repo)
|
||||
{
|
||||
if($repo == 'local')
|
||||
@@ -40,12 +41,9 @@ class openbenchmarking_repositories implements pts_option_interface
|
||||
$test_count = count($repo_index['tests']);
|
||||
$suite_count = count($repo_index['suites']);
|
||||
$generated_time = date('F d H:i', $repo_index['main']['generated']);
|
||||
|
||||
echo sprintf(' REPO: %-20ls WEB: %-35ls' . PHP_EOL, $repo, 'http://openbenchmarking.org/user/' . $repo);
|
||||
echo sprintf(' LAST GENERATED: %-3ls' . PHP_EOL, $generated_time);
|
||||
echo sprintf(' TEST COUNT: %-3ls SUITE COUNT: %-3ls' . PHP_EOL, $test_count, $suite_count);
|
||||
echo PHP_EOL;
|
||||
$repos[] = array(pts_client::cli_just_bold($repo), pts_strings::plural_handler($test_count, 'Test'), pts_strings::plural_handler($suite_count, 'Suite'), $generated_time, 'https://openbenchmarking.org/user/' . $repo);
|
||||
}
|
||||
echo pts_user_io::display_text_table($repos) . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
Phoronix Test Suite
|
||||
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
|
||||
Copyright (C) 2008 - 2022, Phoronix Media
|
||||
Copyright (C) 2008 - 2022, Michael Larabel
|
||||
Copyright (C) 2008 - 2024, Phoronix Media
|
||||
Copyright (C) 2008 - 2024, Michael Larabel
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -453,7 +453,8 @@ class pts_client
|
||||
}
|
||||
else
|
||||
{
|
||||
$config_color_option = pts_config::read_user_config('PhoronixTestSuite/Options/General/ColoredConsole', 'AUTO');
|
||||
// early init process check with PTS_IS_DAEMONIZED_SERVER_PROCESS guard
|
||||
$config_color_option = !defined('PTS_IS_DAEMONIZED_SERVER_PROCESS') ? 'AUTO' : pts_config::read_user_config('PhoronixTestSuite/Options/General/ColoredConsole', 'AUTO');
|
||||
|
||||
switch(strtoupper($config_color_option))
|
||||
{
|
||||
@@ -814,56 +815,43 @@ class pts_client
|
||||
public static function program_requirement_checks($only_show_required = false, $always_report = false)
|
||||
{
|
||||
$extension_checks = pts_needed_extensions();
|
||||
|
||||
$printed_required_header = false;
|
||||
$printed_optional_header = false;
|
||||
$exts = array();
|
||||
$do_exit = false;
|
||||
foreach($extension_checks as $extension)
|
||||
{
|
||||
if($extension[1] == false || $always_report)
|
||||
{
|
||||
if($always_report)
|
||||
if($extension[0] == 1 && $extension[1] == false)
|
||||
{
|
||||
$printed_required_header = true;
|
||||
$printed_optional_header = true;
|
||||
echo ($extension[1] == false ? 'MISSING' : 'PRESENT') . ' - ';
|
||||
$do_exit = true;
|
||||
}
|
||||
|
||||
if($extension[0] == 1)
|
||||
else if($extension[0] != 1)
|
||||
{
|
||||
// Oops, this extension is required
|
||||
if($printed_required_header == false)
|
||||
{
|
||||
echo PHP_EOL . 'The following PHP extensions are REQUIRED:' . PHP_EOL . PHP_EOL;
|
||||
$printed_required_header = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(($only_show_required || PTS_IS_DAEMONIZED_SERVER_PROCESS) && $printed_required_header == false)
|
||||
if(($only_show_required || PTS_IS_DAEMONIZED_SERVER_PROCESS))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// This extension is missing but optional
|
||||
if($printed_optional_header == false)
|
||||
{
|
||||
echo PHP_EOL . ($printed_required_header ? null : 'NOTICE: ') . 'The following PHP extensions are OPTIONAL but recommended:' . PHP_EOL . PHP_EOL;
|
||||
$printed_optional_header = true;
|
||||
}
|
||||
}
|
||||
|
||||
echo sprintf('%-9ls %-30ls' . PHP_EOL, $extension[2], $extension[3]);
|
||||
$exts[] = array($extension[1] == false ? pts_client::cli_colored_text('MISSING', 'red', true) : pts_client::cli_colored_text('PRESENT', 'green') . ' ', pts_client::cli_just_bold($extension[2]) . ' ', ($extension[0] == 1 ? pts_client::cli_just_underline('REQUIRED') : pts_client::cli_just_italic('OPTIONAL')) . ' - ', $extension[3]);
|
||||
}
|
||||
}
|
||||
|
||||
if($printed_required_header || $printed_optional_header)
|
||||
if(!empty($exts))
|
||||
{
|
||||
echo PHP_EOL;
|
||||
|
||||
if($printed_required_header && !$always_report)
|
||||
if($only_show_required)
|
||||
{
|
||||
exit;
|
||||
echo pts_client::cli_just_italic('PHP extensions required to run the Phoronix Test Suite:') . PHP_EOL;
|
||||
}
|
||||
else if($always_report)
|
||||
{
|
||||
echo pts_client::cli_just_italic('Recommended PHP extensions for the Phoronix Test Suite:') . PHP_EOL;
|
||||
}
|
||||
echo pts_user_io::display_text_table($exts) . PHP_EOL . PHP_EOL;
|
||||
}
|
||||
|
||||
if($do_exit)
|
||||
{
|
||||
exit;
|
||||
}
|
||||
}
|
||||
private static function core_storage_init_process()
|
||||
|
||||
@@ -284,7 +284,7 @@ class pts_stress_run_manager extends pts_test_run_manager
|
||||
unlink($pid_file);
|
||||
if(isset($pid_files_to_test_identifier[$pid]))
|
||||
{
|
||||
unset($pid_files_to_test_identifier[$pid]);
|
||||
unset($pid_files_to_test_identifier[intval($pid)]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -464,7 +464,8 @@ class pts_test_installer
|
||||
}
|
||||
else if($download_package->is_optional())
|
||||
{
|
||||
self::test_install_error(null, $test_install_request, 'File failed to download, but package is optional.');
|
||||
self::test_install_error(null, $test_install_request, 'File failed to download, but package may be optional.');
|
||||
self::helper_on_failed_download($test_install_request, $download_package);
|
||||
$objects_completed++;
|
||||
break;
|
||||
}
|
||||
@@ -486,6 +487,7 @@ class pts_test_installer
|
||||
self::test_install_error(null, $test_install_request, 'Download Failed: ' . $url);
|
||||
$checksum_failed = false;
|
||||
}
|
||||
self::helper_on_failed_download($test_install_request, $download_package);
|
||||
|
||||
pts_openbenchmarking_client::upload_usage_data('download_failure', array($test_install_request, $url));
|
||||
|
||||
@@ -556,6 +558,13 @@ class pts_test_installer
|
||||
|
||||
return !$fail_if_no_downloads || $objects_completed > 0;
|
||||
}
|
||||
public static function helper_on_failed_download(&$test_install_request, &$download_package)
|
||||
{
|
||||
if($download_package->get_filesize() > 2147483648 && !function_exists('curl_init'))
|
||||
{
|
||||
self::test_install_error(null, $test_install_request, 'File is large, you may want to install PHP CURL (php-curl) support.');
|
||||
}
|
||||
}
|
||||
public static function create_python_workarounds(&$test_install_request)
|
||||
{
|
||||
// Workarounds for Python i.e. 2023 Debian/Ubuntu screw around with "externally managed" crap that breaks pip user usage...
|
||||
|
||||
@@ -105,18 +105,28 @@ class phodevi_memory extends phodevi_device_interface
|
||||
{
|
||||
$mem_size[] = round($memory_device_data['MEMORY_DEVICE_' . $i . '_SIZE'] / 1073741824); // byte to GB
|
||||
}
|
||||
if(isset($memory_device_data['MEMORY_DEVICE_' . $i . '_SPEED_MTS']) && is_numeric($memory_device_data['MEMORY_DEVICE_' . $i . '_SPEED_MTS']) && $memory_device_data['MEMORY_DEVICE_' . $i . '_SPEED_MTS'] > 1000)
|
||||
if(isset($memory_device_data['MEMORY_DEVICE_' . $i . '_CONFIGURED_SPEED_MTS']) && is_numeric($memory_device_data['MEMORY_DEVICE_' . $i . '_CONFIGURED_SPEED_MTS']) && $memory_device_data['MEMORY_DEVICE_' . $i . '_CONFIGURED_SPEED_MTS'] > 1000)
|
||||
{
|
||||
$mem_speed[] = $memory_device_data['MEMORY_DEVICE_' . $i . '_CONFIGURED_SPEED_MTS'] . 'MT/s';
|
||||
}
|
||||
else if(isset($memory_device_data['MEMORY_DEVICE_' . $i . '_SPEED_MTS']) && is_numeric($memory_device_data['MEMORY_DEVICE_' . $i . '_SPEED_MTS']) && $memory_device_data['MEMORY_DEVICE_' . $i . '_SPEED_MTS'] > 1000)
|
||||
{
|
||||
$mem_speed[] = $memory_device_data['MEMORY_DEVICE_' . $i . '_SPEED_MTS'] . 'MT/s';
|
||||
}
|
||||
|
||||
if(isset($memory_device_data['MEMORY_DEVICE_' . $i . '_MEMORY_TYPE']))
|
||||
{
|
||||
$mem_type[] = $memory_device_data['MEMORY_DEVICE_' . $i . '_MEMORY_TYPE'];
|
||||
}
|
||||
else if(isset($memory_device_data['MEMORY_DEVICE_' . $i . '_TYPE']))
|
||||
{
|
||||
$mem_type[] = $memory_device_data['MEMORY_DEVICE_' . $i . '_TYPE'];
|
||||
}
|
||||
else if(isset($memory_device_data['MEMORY_DEVICE_' . $i . '_MEMORY_TECHNOLOGY']))
|
||||
{
|
||||
$mem_type[] = $memory_device_data['MEMORY_DEVICE_' . $i . '_MEMORY_TECHNOLOGY'];
|
||||
}
|
||||
|
||||
if(isset($memory_device_data['MEMORY_DEVICE_' . $i . '_MANUFACTURER']))
|
||||
{
|
||||
$mem_manufacturer[] = $memory_device_data['MEMORY_DEVICE_' . $i . '_MANUFACTURER'];
|
||||
@@ -248,14 +258,14 @@ class phodevi_memory extends phodevi_device_interface
|
||||
|
||||
if(!empty($mem_manufacturer))
|
||||
{
|
||||
$mem_manufacturer = str_ireplace(' Technology', '', $mem_manufacturer);
|
||||
$mem_manufacturer = str_ireplace(array(' Technology', ' Intl'), '', $mem_manufacturer);
|
||||
}
|
||||
if(isset($mem_manufacturer[2]) && pts_strings::is_alpha($mem_manufacturer[0]) && stripos($mem_manufacturer, 'manufacturer') === false && stripos($mem_manufacturer, 'part') === false && stripos($mem_manufacturer, 'module') === false && stripos($mem_manufacturer, 'dimm') === false && pts_strings::is_alpha($mem_manufacturer))
|
||||
if(isset($mem_manufacturer[2]) && pts_strings::is_alpha($mem_manufacturer[0]) && stripos($mem_manufacturer, 'manufacturer') === false && stripos($mem_manufacturer, 'part') === false && stripos($mem_manufacturer, 'module') === false && stripos($mem_manufacturer, 'dimm') === false && pts_strings::is_alpha(str_replace(' ', '', $mem_manufacturer)))
|
||||
{
|
||||
$product_string .= ' ' . $mem_manufacturer;
|
||||
}
|
||||
|
||||
if(($x = strpos($mem_part, '/')) !== false)
|
||||
if(!empty($mem_part) && ($x = strpos($mem_part, '/')) !== false)
|
||||
{
|
||||
// Cleanup/shorten strings like KHX2133C13S4/4G
|
||||
$mem_part = substr($mem_part, 0, $x);
|
||||
|
||||
@@ -509,40 +509,27 @@ class phodevi_motherboard extends phodevi_device_interface
|
||||
{
|
||||
$vendor = phodevi_linux_parser::read_sys_dmi(array('board_vendor', 'sys_vendor'));
|
||||
$name = phodevi_linux_parser::read_sys_dmi(array('board_name', 'product_name'));
|
||||
$version = phodevi_linux_parser::read_sys_dmi(array('board_version', 'product_version'));
|
||||
$product_name = phodevi_linux_parser::read_sys_dmi(array('product_name'));
|
||||
$board_version = phodevi_linux_parser::read_sys_dmi(array('board_version'));
|
||||
$product_version = phodevi_linux_parser::read_sys_dmi(array('product_version'));
|
||||
|
||||
if($vendor != false && $name != false)
|
||||
if($vendor != false && ($name != false || $product_name != false))
|
||||
{
|
||||
$info = strpos($name . ' ', $vendor . ' ') === false ? $vendor . ' ' : null;
|
||||
$info .= $name;
|
||||
|
||||
if($version != false && strpos($info, $version) === false && pts_strings::string_only_contains($version, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL))
|
||||
if(strtolower($vendor) == 'lenovo' && strpos($info, $product_version) === false)
|
||||
{
|
||||
$info .= (substr($version, 0, 1) == 'v' ? ' ' : ' v') . $version;
|
||||
$info = str_replace($vendor . ' ', $vendor . ' ' . $product_version . ' ', $info);
|
||||
}
|
||||
else if($product_name != null && stripos($info, $product_name) === false)
|
||||
{
|
||||
$info = str_replace($vendor . ' ', $vendor . ' ' . str_ireplace(array('Desktop PC'), '', $product_name) . ' ', $info);
|
||||
}
|
||||
|
||||
if((phodevi::is_root() || is_readable('/dev/mem')) && pts_client::executable_in_path('dmidecode'))
|
||||
if($board_version != false && stripos($info, $board_version) === false && pts_strings::string_only_contains($board_version, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL))
|
||||
{
|
||||
// For some vendors, it's better to read system-product-name
|
||||
// Unfortunately other vendors report garbage here, also dmidecode only works as root on Linux
|
||||
foreach(array('Dell', 'Apple') as $vend)
|
||||
{
|
||||
if(stripos($info, $vend . ' ') !== false)
|
||||
{
|
||||
$dmi_output = shell_exec('dmidecode -s system-product-name 2>&1');
|
||||
if($dmi_output != null && stripos($dmi_output, ' ') !== false && stripos($dmi_output, 'invalid') === false && stripos($dmi_output, 'System Product') === false && stripos($dmi_output, 'not ') === false)
|
||||
{
|
||||
$old_info = trim(str_ireplace(array($vend . ' ', 'Inc.'), '', $info));
|
||||
$info = trim($dmi_output) . (!empty($old_info) && strpos($dmi_output, $old_info) === false ? ' [' . $old_info . ']' : '');
|
||||
}
|
||||
|
||||
if($info != null && stripos($info, $vend) === false)
|
||||
{
|
||||
$info = $vend . ' ' . $info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$info .= (substr($board_version, 0, 1) == 'v' ? ' ' : ' v') . $board_version;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -181,18 +181,22 @@ class phodevi_linux_parser
|
||||
|
||||
return $sysfs_file_cache[$arg_hash] == false ? -1 : pts_file_io::file_get_contents($sysfs_file_cache[$arg_hash]);
|
||||
}
|
||||
public static function read_udevadm_info($data_r)
|
||||
public static function read_udevadm_info($data_r, $node = '/sys/devices/virtual/dmi/id')
|
||||
{
|
||||
$device_data = array();
|
||||
|
||||
if(pts_client::executable_in_path('udevadm'))
|
||||
{
|
||||
foreach(explode(PHP_EOL, shell_exec('udevadm info -e 2>/dev/null | grep -e ' . implode(' -e ', $data_r))) as $line)
|
||||
$udev_output = shell_exec('udevadm info ' . $node . ' 2>/dev/null | grep -e ' . implode(' -e ', $data_r));
|
||||
if(!empty($udev_output))
|
||||
{
|
||||
$line = explode('=', str_replace(array('E: ', '<OUT OF SPEC>', '00000000', 'Not Specified', 'Unknown', 'None'), '', $line));
|
||||
if(count($line) == 2 && !empty($line[0]) && !empty($line[1]))
|
||||
foreach(explode(PHP_EOL, $udev_output) as $line)
|
||||
{
|
||||
$device_data[$line[0]] = $line[1];
|
||||
$line = explode('=', str_replace(array('E: ', '<OUT OF SPEC>', '00000000', 'Not Specified', 'Unknown', 'None'), '', $line));
|
||||
if(count($line) == 2 && !empty($line[0]) && !empty($line[1]))
|
||||
{
|
||||
$device_data[$line[0]] = $line[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,6 +626,7 @@ class pts_validation
|
||||
$set_api = null;
|
||||
$default_value = null;
|
||||
$flags = null;
|
||||
$class = null;
|
||||
$dynamic_list_multi = '';
|
||||
$nodes_to_match = array('set' => 'set_api', 'get' => 'get_api', 'default' => 'default_value', 'flags' => 'flags', 'dynamic_list_multi' => 'dynamic_list_multi');
|
||||
$cnodes = $el->getElementsByTagName('*');
|
||||
|
||||
Reference in New Issue
Block a user