public static function module_framework_init() { // Process initially called when PTS starts up // Check for modules to auto-load from the configuration file $load_modules = pts_config::read_user_config('PhoronixTestSuite/Options/Modules/LoadModules', null); if (!empty($load_modules)) { foreach (pts_strings::comma_explode($load_modules) as $module) { $module_r = pts_strings::trim_explode('=', $module); if (count($module_r) == 2) { // TODO: end up hooking this into pts_module::read_variable() rather than using the real env pts_client::set_environment_variable($module_r[0], $module_r[1]); } else { pts_module_manager::attach_module($module); } } } // Check for modules to load manually in PTS_MODULES if (($load_modules = pts_client::read_env('PTS_MODULES')) !== false) { foreach (pts_strings::comma_explode($load_modules) as $module) { if (!pts_module_manager::is_module_attached($module)) { pts_module_manager::attach_module($module); } } } // Detect modules to load automatically pts_module_manager::detect_modules_to_load(); // Clean-up modules list pts_module_manager::clean_module_list(); // Reset counter pts_module_manager::set_current_module(null); // Load the modules $module_store_list = array(); foreach (pts_module_manager::attached_modules() as $module) { $class_vars = get_class_vars($module); $module_store_vars = isset($class_vars['module_store_vars']) ? $class_vars['module_store_vars'] : null; if (is_array($module_store_vars)) { foreach ($module_store_vars as $store_var) { if (!in_array($store_var, $module_store_list)) { array_push($module_store_list, $store_var); } } } } // Should any of the module options be saved to the results? foreach ($module_store_list as $var) { $var_value = pts_client::read_env($var); if (!empty($var_value)) { pts_module_manager::var_store_add($var, $var_value); } } pts_module_manager::module_process('__startup'); pts_define('PTS_STARTUP_TASK_PERFORMED', true); register_shutdown_function(array('pts_module_manager', 'module_process'), '__shutdown'); }
public static function process_environment_variables_string_to_set($env_var_string) { if (!empty($env_var_string)) { foreach (explode(';', $env_var_string) as $ev) { if (strpos($ev, '=') != false) { list($var, $value) = pts_strings::trim_explode('=', $ev); pts_client::set_environment_variable($var, $value); pts_module_manager::var_store_add($var, $value); } } pts_module_manager::detect_modules_to_load(); } }