diff options
-rw-r--r-- | pts-core/functions/pts-functions-install.php | 2 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-install_dependencies.php | 2 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 6 | ||||
-rw-r--r-- | pts-core/functions/pts-functions.php | 14 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_config.php | 2 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_shell.php | 83 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system.php | 16 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system_software.php | 146 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_tests.php | 2 | ||||
-rw-r--r-- | pts-core/functions/pts-init.php | 2 |
10 files changed, 138 insertions, 137 deletions
diff --git a/pts-core/functions/pts-functions-install.php b/pts-core/functions/pts-functions-install.php index 7208c2c..19ec36e 100644 --- a/pts-core/functions/pts-functions-install.php +++ b/pts-core/functions/pts-functions-install.php @@ -320,7 +320,7 @@ function pts_install_test($identifier) $installed = false; if(!pts_test_architecture_supported($identifier)) { - echo pts_string_header($identifier . " is not supported on this architecture: " . kernel_arch()); + echo pts_string_header($identifier . " is not supported on this architecture: " . sw_os_architecture()); } else if(!pts_test_platform_supported($identifier)) { diff --git a/pts-core/functions/pts-functions-install_dependencies.php b/pts-core/functions/pts-functions-install_dependencies.php index 5f32e9a..2b5fae3 100644 --- a/pts-core/functions/pts-functions-install_dependencies.php +++ b/pts-core/functions/pts-functions-install_dependencies.php @@ -117,7 +117,7 @@ function pts_install_external_dependencies_list($identifier, &$INSTALL_OBJ) { array_push($dependencies, "php-extras"); - if(kernel_arch() == "x86_64") + if(sw_os_architecture() == "x86_64") { array_push($dependencies, "linux-32bit-libraries"); } diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index d687dd9..8d99a3a 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -227,7 +227,7 @@ function pts_generate_test_notes($test_type) // Power Saving Technologies? pts_add_test_note(hw_cpu_power_savings_enabled()); pts_add_test_note(hw_sys_power_mode()); - pts_add_test_note(system_virtualized_mode()); + pts_add_test_note(sw_os_virtualized_mode()); if($test_type == "Graphics" || $test_type == "System") { @@ -705,12 +705,12 @@ function pts_global_auto_tags($extra_attr = null) array_push($tags_array, "NVIDIA"); } - if(kernel_arch() == "x86_64" && IS_LINUX) + if(sw_os_architecture() == "x86_64" && IS_LINUX) { array_push($tags_array, "64-bit Linux"); } - $os = operating_system_release(); + $os = sw_os_release(); if($os != "Unknown") { array_push($tags_array, $os); diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php index 40b791c..e80b7ea 100644 --- a/pts-core/functions/pts-functions.php +++ b/pts-core/functions/pts-functions.php @@ -182,8 +182,8 @@ function pts_env_variables() "VIDEO_MONITOR_LAYOUT" => hw_gpu_monitor_layout(), "VIDEO_MONITOR_SIZES" => hw_gpu_monitor_modes(), "OPERATING_SYSTEM" => pts_vendor_identifier(), - "OS_VERSION" => os_version(), - "OS_ARCH" => kernel_arch(), + "OS_VERSION" => sw_os_version(), + "OS_ARCH" => sw_os_architecture(), "OS_TYPE" => OPERATING_SYSTEM, "THIS_RUN_TIME" => THIS_RUN_TIME ); @@ -200,14 +200,14 @@ function pts_user_runtime_variables() $runtime_variables = array( "VIDEO_RESOLUTION" => hw_gpu_current_mode(), "VIDEO_CARD" => hw_gpu_string(), - "VIDEO_DRIVER" => opengl_version(), - "OPERATING_SYSTEM" => operating_system_release(), + "VIDEO_DRIVER" => sw_os_opengl(), + "OPERATING_SYSTEM" => sw_os_release(), "PROCESSOR" => hw_cpu_string(), "MOTHERBOARD" => hw_sys_motherboard_string(), "CHIPSET" => hw_sys_chipset_string(), - "KERNEL_VERSION" => kernel_string(), - "COMPILER" => compiler_version(), - "HOSTNAME" => system_hostname() + "KERNEL_VERSION" => sw_os_kernel(), + "COMPILER" => sw_os_compiler(), + "HOSTNAME" => sw_os_hostname() ); } diff --git a/pts-core/functions/pts-functions_config.php b/pts-core/functions/pts-functions_config.php index 5fd564e..cb201d4 100644 --- a/pts-core/functions/pts-functions_config.php +++ b/pts-core/functions/pts-functions_config.php @@ -348,7 +348,7 @@ function pts_current_user() if($pts_user == "Default User") { - $pts_user = system_user_name(); + $pts_user = sw_os_username(); } return $pts_user; diff --git a/pts-core/functions/pts-functions_shell.php b/pts-core/functions/pts-functions_shell.php index 87da4c1..5508cd5 100644 --- a/pts-core/functions/pts-functions_shell.php +++ b/pts-core/functions/pts-functions_shell.php @@ -154,5 +154,88 @@ function pts_run_shell_script($file, $arguments = "") return shell_exec("sh " . $file . " ". $arguments . " 2>&1"); } +function pts_process_running_bool($process) +{ + // Checks if process is running on the system + $running = shell_exec("ps -C " . strtolower($process) . " 2>&1"); + $running = trim(str_replace(array("PID", "TTY", "TIME", "CMD"), "", $running)); + + if(!empty($running)) + { + $running = true; + } + else + { + $running = false; + } + + if(IS_MACOSX || IS_SOLARIS) + { + $running = false; + } + + return $running; +} +function pts_process_running_string($process_arr) +{ + // Format a nice string that shows processes running + $p = array(); + $p_string = ""; + + if(!is_array($process_arr)) + { + $process_arr = array($process_arr); + } + + foreach($process_arr as $p_name => $p_process) + { + if(!is_array($p_process)) + { + $p_process = array($p_process); + } + + foreach($p_process as $process) + { + if(pts_process_running_bool($process)) + { + array_push($p, $p_name); + } + } + } + + $p = array_keys(array_flip($p)); + + if(($p_count = count($p)) > 0) + { + for($i = 0; $i < $p_count; $i++) + { + $p_string .= $p[$i]; + + if($i != ($p_count - 1) && $p_count > 2) + { + $p_string .= ","; + } + $p_string .= " "; + + if($i == ($p_count - 2)) + { + $p_string .= "and "; + } + } + + if($p_count == 1) + { + $p_string .= "was"; + } + else + { + $p_string .= "were"; + } + + $p_string .= " running on this system"; + } + + return $p_string; +} ?> diff --git a/pts-core/functions/pts-functions_system.php b/pts-core/functions/pts-functions_system.php index f73cd00..f78a570 100644 --- a/pts-core/functions/pts-functions_system.php +++ b/pts-core/functions/pts-functions_system.php @@ -47,24 +47,24 @@ function pts_sw_string() // Returns string of software information $software = array(); - array_push($software, "OS: " . operating_system_release()); - array_push($software, "Kernel: " . kernel_string() . " (" . kernel_arch() . ")"); - array_push($software, "X.Org Server: " . graphics_subsystem_version()); + array_push($software, "OS: " . sw_os_release()); + array_push($software, "Kernel: " . sw_os_kernel() . " (" . sw_os_architecture() . ")"); + array_push($software, "X.Org Server: " . sw_os_graphics_subsystem()); - if(($ddx = xorg_ddx_driver_info()) != "") + if(($ddx = sw_xorg_ddx_driver_info()) != "") { array_push($software, "X.Org Driver: " . $ddx); } - array_push($software, "OpenGL: " . opengl_version()); - array_push($software, "Compiler: " . compiler_version()); - array_push($software, "File-System: " . filesystem_type()); + array_push($software, "OpenGL: " . sw_os_opengl()); + array_push($software, "Compiler: " . sw_os_compiler()); + array_push($software, "File-System: " . sw_os_filesystem()); return implode(", ", $software); } function pts_system_identifier_string() { - $components = array(hw_cpu_string(), hw_sys_motherboard_string(), operating_system_release(), compiler_version()); + $components = array(hw_cpu_string(), hw_sys_motherboard_string(), sw_os_release(), sw_os_compiler()); return base64_encode(implode("__", $components)); } diff --git a/pts-core/functions/pts-functions_system_software.php b/pts-core/functions/pts-functions_system_software.php index b1518bf..d4d72ff 100644 --- a/pts-core/functions/pts-functions_system_software.php +++ b/pts-core/functions/pts-functions_system_software.php @@ -21,11 +21,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -function system_virtualized_mode() +function pts_vendor_identifier() +{ + // Returns the vendor identifier used with the External Dependencies and other distro-specific features + $vendor = sw_os_vendor(); + + if($vendor == "Unknown") + { + $vendor = sw_os_release(); + + if(($spos = strpos($vendor, " ")) > 1) + { + $vendor = substr($vendor, 0, $spos); + } + } + + return strtolower($vendor); +} +function sw_os_virtualized_mode() { // Reports if system is running virtualized $virtualized = ""; - $gpu = graphics_processor_string(); + $gpu = hw_gpu_string(); if(strpos(hw_cpu_string(), "QEMU") !== false) { @@ -47,7 +64,7 @@ function system_virtualized_mode() return $virtualized; } -function filesystem_type() +function sw_os_filesystem() { // Determine file-system type $fs = shell_exec("stat " . TEST_ENV_DIR . " -L -f -c %T 2> /dev/null"); @@ -64,7 +81,7 @@ function filesystem_type() return $fs; } -function system_hostname() +function sw_os_hostname() { $hostname = "Unknown"; @@ -75,7 +92,7 @@ function system_hostname() return $hostname; } -function compiler_version() +function sw_os_compiler() { // Returns version of the compiler (if present) $info = shell_exec("gcc -dumpversion 2>&1"); @@ -88,7 +105,7 @@ function compiler_version() return $gcc_info; } -function kernel_arch() +function sw_os_architecture() { // Find out the kernel archiecture $kernel_arch = trim(shell_exec("uname -m 2>&1")); @@ -104,17 +121,17 @@ function kernel_arch() return $kernel_arch; } -function kernel_string() +function sw_os_kernel() { // Returns kernel return trim(shell_exec("uname -r 2>&1")); } -function os_vendor() +function sw_os_vendor() { // Returns OS vendor return read_lsb("Distributor ID"); } -function os_version() +function sw_os_version() { // Returns OS version $os_version = read_lsb("Release"); @@ -134,10 +151,10 @@ function os_version() return $os_version; } -function operating_system_release() +function sw_os_release() { // Determine the operating system release - $vendor = os_vendor(); + $vendor = sw_os_vendor(); $version = os_version(); if($vendor == "Unknown" && $version == "Unknown") @@ -199,7 +216,7 @@ function operating_system_release() return $os; } -function opengl_version() +function sw_os_opengl() { // OpenGL version $info = shell_exec("glxinfo 2>&1 | grep version"); @@ -217,7 +234,7 @@ function opengl_version() return $info; } -function xorg_ddx_driver_info() +function sw_xorg_ddx_driver_info() { $ddx_info = ""; @@ -251,7 +268,7 @@ function xorg_ddx_driver_info() return $ddx_info; } -function graphics_subsystem_version() +function sw_os_graphics_subsystem() { // Find graphics subsystem version if(IS_SOLARIS) @@ -287,24 +304,7 @@ function graphics_subsystem_version() return $info; } -function pts_vendor_identifier() -{ - // Returns the vendor identifier used with the External Dependencies and other distro-specific features - $vendor = os_vendor(); - - if($vendor == "Unknown") - { - $vendor = operating_system_release(); - - if(($spos = strpos($vendor, " ")) > 1) - { - $vendor = substr($vendor, 0, $spos); - } - } - - return strtolower($vendor); -} -function system_user_name() +function sw_os_username() { // Gets the system user's name if(function_exists("posix_getpwuid") && function_exists("posix_getuid")) @@ -319,87 +319,5 @@ function system_user_name() return $username; } -function pts_process_running_bool($process) -{ - // Checks if process is running on the system - $running = shell_exec("ps -C " . strtolower($process) . " 2>&1"); - $running = trim(str_replace(array("PID", "TTY", "TIME", "CMD"), "", $running)); - if(!empty($running)) - { - $running = true; - } - else - { - $running = false; - } - - if(IS_MACOSX || IS_SOLARIS) - { - $running = false; - } - - return $running; -} -function pts_process_running_string($process_arr) -{ - // Format a nice string that shows processes running - $p = array(); - $p_string = ""; - - if(!is_array($process_arr)) - { - $process_arr = array($process_arr); - } - - foreach($process_arr as $p_name => $p_process) - { - if(!is_array($p_process)) - { - $p_process = array($p_process); - } - - foreach($p_process as $process) - { - if(pts_process_running_bool($process)) - { - array_push($p, $p_name); - } - } - } - - $p = array_keys(array_flip($p)); - - if(($p_count = count($p)) > 0) - { - for($i = 0; $i < $p_count; $i++) - { - $p_string .= $p[$i]; - - if($i != ($p_count - 1) && $p_count > 2) - { - $p_string .= ","; - } - $p_string .= " "; - - if($i == ($p_count - 2)) - { - $p_string .= "and "; - } - } - - if($p_count == 1) - { - $p_string .= "was"; - } - else - { - $p_string .= "were"; - } - - $p_string .= " running on this system"; - } - - return $p_string; -} ?> diff --git a/pts-core/functions/pts-functions_tests.php b/pts-core/functions/pts-functions_tests.php index dcb9a7a..bd02665 100644 --- a/pts-core/functions/pts-functions_tests.php +++ b/pts-core/functions/pts-functions_tests.php @@ -715,7 +715,7 @@ function pts_call_test_script($test_identifier, $script_name, $print_string = "" function pts_cpu_arch_compatible($check_against) { $compatible = true; - $this_arch = kernel_arch(); + $this_arch = sw_os_architecture(); if(strlen($this_arch) > 3 && substr($this_arch, -2) == "86") { diff --git a/pts-core/functions/pts-init.php b/pts-core/functions/pts-init.php index 40aa63b..7f0818e 100644 --- a/pts-core/functions/pts-init.php +++ b/pts-core/functions/pts-init.php @@ -158,7 +158,7 @@ function pts_extended_init() // OpenGL / graphics detection $graphics_detection = array("NVIDIA", array("ATI", "fglrx"), "Mesa"); - $opengl_driver = opengl_version() . " " . xorg_ddx_driver_info(); + $opengl_driver = sw_os_opengl() . " " . sw_xorg_ddx_driver_info(); $found_gpu_match = false; foreach($graphics_detection as $gpu_check) |