Best Phoronix-test-suite code snippet using pts_config.read_user_config
pts_network.php
Source:pts_network.php
...270 $last_float = $downloaded_float;271 }272 public static function client_startup()273 {274 if(($proxy_address = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyAddress', false)) && ($proxy_port = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyPort', false)))275 {276 // Don't need http:// in address and some people mistakenly do it277 // e.g. https://www.phoronix.com/forums/forum/phoronix/phoronix-test-suite/905211-problem-network-support-is-needed-to-obtain-package278 $proxy_address = str_replace(array('http://', 'https://'), '', $proxy_address);279 self::$network_proxy['proxy'] = $proxy_address . ':' . $proxy_port;280 self::$network_proxy['address'] = $proxy_address;281 self::$network_proxy['port'] = $proxy_port;282 self::$network_proxy['user'] = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyUser', false);283 self::$network_proxy['password'] = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyPassword', false);284 }285 else if(($env_proxy = getenv('http_proxy')) != false && count($env_proxy = pts_strings::colon_explode($env_proxy)) == 2)286 {287 self::$network_proxy['proxy'] = $env_proxy[0] . ':' . $env_proxy[1];288 self::$network_proxy['address'] = $env_proxy[0];289 self::$network_proxy['port'] = $env_proxy[1];290 self::$network_proxy['user'] = false; // TODO is there any env vars usually storing proxy user/pw?291 self::$network_proxy['password'] = false;292 }293 self::$network_timeout = pts_config::read_user_config('PhoronixTestSuite/Options/Networking/Timeout', 20);294 if(ini_get('allow_url_fopen') == 'Off')295 {296 if(!defined('PHOROMATIC_SERVER'))297 {298 echo PHP_EOL . 'The allow_url_fopen option in your PHP configuration must be enabled for network support.' . PHP_EOL . PHP_EOL;299 }300 self::$disable_network_support = true;301 }302 else if(pts_config::read_bool_config('PhoronixTestSuite/Options/Networking/NoInternetCommunication', 'FALSE'))303 {304 if(!defined('PHOROMATIC_SERVER'))305 {306 echo PHP_EOL . 'Internet Communication Is Disabled Per Your User Configuration.' . PHP_EOL . PHP_EOL;307 }...
phoromatic_admin_config.php
Source:phoromatic_admin_config.php
...107 }108 if(is_dir($_POST['new_dc_path']))109 {110 $new_dc_dir = pts_strings::add_trailing_slash($_POST['new_dc_path']);111 if(pts_file_io::copy(pts_strings::add_trailing_slash(pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH))), $new_dc_dir))112 {113 pts_config::user_config_generate(array('CacheDirectory' => $new_dc_dir));114 header('Location: /?admin');115 }116 else117 {118 $main .= '<h2 style="color: red;"><em>Failed to copy old Phoromatic data to new location.</h2>';119 }120 }121 }122 }123 if(isset($_POST['new_proxy_address']) && isset($_POST['new_proxy_port']))124 {125 if(pts_network::http_get_contents('http://www.phoronix-test-suite.com/PTS', $_POST['new_proxy_address'], $_POST['new_proxy_port']) == 'PTS')126 {127 pts_config::user_config_generate(array(128 'PhoronixTestSuite/Options/Networking/ProxyAddress' => $_POST['new_proxy_address'],129 'PhoronixTestSuite/Options/Networking/ProxyPort' => $_POST['new_proxy_port']130 ));131 }132 else133 {134 $main .= '<h2 style="color: red;">Failed to connect via proxy server.</h2>';135 }136 }137 if(isset($_POST['new_http_port']) && isset($_POST['new_ws_port']))138 {139 if(empty($_POST['new_http_port']) || (!is_numeric($_POST['new_http_port']) && $_POST['new_http_port'] != 'RANDOM'))140 {141 $main .= '<h2 style="color: red;">The HTTP port must be a valid port number or <em>RANDOM</em>.</h2>';142 }143 if(empty($_POST['new_ws_port']) || (!is_numeric($_POST['new_ws_port']) && $_POST['new_ws_port'] != 'RANDOM'))144 {145 $main .= '<h2 style="color: red;">The WebSocket port must be a valid port number or <em>RANDOM</em>.</h2>';146 }147 pts_config::user_config_generate(array(148 'PhoronixTestSuite/Options/Server/RemoteAccessPort' => $_POST['new_http_port'],149 'PhoronixTestSuite/Options/Server/WebSocketPort' => $_POST['new_ws_port']150 ));151 }152 if(isset($_POST['add_new_users_to_account']))153 {154 if(empty($_POST['add_new_users_to_account']))155 {156 phoromatic_server::save_setting('add_new_users_to_account', null);157 }158 else159 {160 $stmt = phoromatic_server::$db->prepare('SELECT COUNT(AccountID) AS AccountHitCount FROM phoromatic_accounts WHERE AccountID = :account_id');161 $stmt->bindValue(':account_id', $_POST['add_new_users_to_account']);162 $result = $stmt->execute();163 $row = $result->fetchArray();164 if(empty($row['AccountHitCount']))165 {166 $main .= '<h2 style="color: red;"><em>' . $_POST['add_new_users_to_account'] . '</em> is not a valid account ID.</h2>';167 }168 else169 {170 phoromatic_server::save_setting('add_new_users_to_account', $_POST['add_new_users_to_account']);171 }172 }173 }174 if(isset($_POST['account_creation_alt']))175 {176 phoromatic_server::save_setting('account_creation_alt', $_POST['account_creation_alt']);177 }178 if(isset($_POST['main_page_message']))179 {180 phoromatic_server::save_setting('main_page_message', $_POST['main_page_message']);181 }182 if(isset($_POST['force_result_sharing']))183 {184 phoromatic_server::save_setting('force_result_sharing', $_POST['force_result_sharing']);185 }186 if(isset($_POST['show_local_tests_only']))187 {188 phoromatic_server::save_setting('show_local_tests_only', $_POST['show_local_tests_only']);189 }190 if(isset($_POST['new_admin_support_email']))191 {192 phoromatic_server::save_setting('admin_support_email', $_POST['new_admin_support_email']);193 }194 if(isset($_POST['rebuild_results_db']))195 {196 foreach(pts_file_io::glob(phoromatic_server::phoromatic_path() . 'accounts/*/results/*/composite.xml') as $composite_xml)197 {198 $account_id = basename(dirname(dirname(dirname($composite_xml))));199 $upload_id = basename(dirname($composite_xml));200 $result_file = new pts_result_file($composite_xml);201 // Validate the XML202 $relative_id = 0;203 foreach($result_file->get_result_objects() as $result_object)204 {205 $relative_id++;206 $stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_results_results (AccountID, UploadID, AbstractID, TestProfile, ComparisonHash) VALUES (:account_id, :upload_id, :abstract_id, :test_profile, :comparison_hash)');207 $stmt->bindValue(':account_id', $account_id);208 $stmt->bindValue(':upload_id', $upload_id);209 $stmt->bindValue(':abstract_id', $relative_id);210 $stmt->bindValue(':test_profile', $result_object->test_profile->get_identifier());211 $stmt->bindValue(':comparison_hash', $result_object->get_comparison_hash(true, false));212 $result = $stmt->execute();213 }214 if($relative_id > 0)215 {216 foreach($result_file->get_systems() as $s)217 {218 $stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_results_systems (AccountID, UploadID, SystemIdentifier, Hardware, Software) VALUES (:account_id, :upload_id, :system_identifier, :hardware, :software)');219 $stmt->bindValue(':account_id', $account_id);220 $stmt->bindValue(':upload_id', $upload_id);221 $stmt->bindValue(':system_identifier', $s->get_identifier());222 $stmt->bindValue(':hardware', $s->get_hardware());223 $stmt->bindValue(':software', $s->get_software());224 $result = $stmt->execute();225 }226 }227 }228 }229 $main .= '<h1>Phoromatic Server Configuration</h1>';230 $main .= '<h2>Phoromatic Storage Location</h2>';231 $main .= '<p>The Phoromatic Storage location is where all Phoromatic-specific test results, account data, and other information is archived. This path is controlled via the <em>' . pts_config::get_config_file_location() . '</em> configuration file with the <em>PhoromaticStorage</em> element. Adjusting the directory from the user configuration XML file is the recommended way to adjust the Phoromatic storage path when the Phoromatic Server is not running, while using the below form is an alternative method to attempt to live migrate the storage path.</p>';232 $main .= '<p><strong>Current Storage Path:</strong> ' . phoromatic_server::phoromatic_path() . '</p>';233 $main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_phoromatic_path" method="post">';234 $main .= '<p><input type="text" name="new_phoromatic_path" value="' . (isset($_POST['new_phoromatic_path']) ? $_POST['new_phoromatic_path'] : null) . '" /></p>';235 $main .= '<p><input name="submit" value="Update Phoromatic Storage Location" type="submit" /></p>';236 $main .= '</form>';237 $main .= '<hr /><h2>Download Cache Location</h2>';238 $main .= '<p>The download cache is where the Phoronix Test Suite is able to make an archive of files needed by test profiles. The Phoromatic Server is then able to allow Phoronix Test Suite client systems on the intranet. To add test files to this cache on the Phoromatic Server, run <strong>phoronix-test-suite make-download-cache <em><the test identifers you wish to download and cache></em></strong>.</p>';239 $main .= '<p><strong>Current Download Cache Path:</strong> ' . pts_strings::add_trailing_slash(pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH))) . '</p>';240 $main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_dc_path" method="post">';241 $main .= '<p><input type="text" name="new_dc_path" value="' . (isset($_POST['new_dc_path']) ? $_POST['new_dc_path'] : null) . '" /></p>';242 $main .= '<p><input name="submit" value="Update Download Cache Location" type="submit" /></p>';243 $main .= '</form>';244 $main .= '<hr /><h2>Network Proxy</h2>';245 $main .= '<p>If a network proxy is needed for the Phoromatic Server to access the open Internet, please provide the IP address and HTTP port address below.</p>';246 $main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_proxy" method="post">';247 $main .= '<p><strong>Proxy HTTP Port:</strong> <input type="text" name="new_proxy_port" size="4" value="' . (isset($_POST['new_proxy_port']) ? $_POST['new_proxy_port'] : pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyPort')) . '" /></p>';248 $main .= '<p><strong>Proxy IP Address:</strong> <input type="text" name="new_proxy_address" value="' . (isset($_POST['new_proxy_address']) ? $_POST['new_proxy_address'] : pts_config::read_user_config('PhoronixTestSuite/Options/Networking/ProxyAddress')) . '" /></p>';249 $main .= '<p><input name="submit" value="Update Network Proxy" type="submit" /></p>';250 $main .= '</form>';251 $main .= '<hr /><h2>Phoromatic Server Ports</h2>';252 $main .= '<p>The HTTP and WebSocket ports for the Phoromatic Server can be adjusted via this form or the user configuration XML file. The new ports will not go into effect until the Phoromatic Server instance has been restarted.</p>';253 $main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_ports" method="post">';254 $main .= '<p><strong>HTTP Port:</strong> <input type="text" name="new_http_port" size="4" value="' . (isset($_POST['new_http_port']) ? $_POST['new_http_port'] : pts_config::read_user_config('PhoronixTestSuite/Options/Server/RemoteAccessPort')) . '" /></p>';255 $main .= '<p><strong>WebSocket Port:</strong> <input type="text" name="new_ws_port" size="4" value="' . (isset($_POST['new_ws_port']) ? $_POST['new_ws_port'] : pts_config::read_user_config('PhoronixTestSuite/Options/Server/WebSocketPort')) . '" /></p>';256 $main .= '<p><input name="submit" value="Update Web Ports" type="submit" /></p>';257 $main .= '</form>';258 $main .= '<hr /><h2>Support Email Address</h2>';259 $main .= '<p>This email address will be shown as the sender of emails regarding new account registration and other non-group-related messages. This email address may also be shown as a support email address in case of user problems.</p>';260 $main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="support_email" method="post">';261 $main .= '<p><strong>E-Mail:</strong> <input type="text" name="new_admin_support_email" value="' . phoromatic_server::read_setting('admin_support_email') . '" /></p>';262 $main .= '<p><input name="submit" value="Update E-Mail Address" type="submit" /></p>';263 $main .= '</form>';264 $main .= '<hr /><h1>Account Creation</h1>';265 $main .= '<h2>Add To Existing Account</h2><p>Whenever a new account is created via the main log-in page, rather than creating a new group account, you can opt to have the account added as a viewer to an existing group of accounts. To do so, enter the account ID in the field below. The user is added to that account ID with viewer privileges while the main administrator for that account can elevate the privileges from their account\'s Users page. You can find the list of account IDs via the main rootadmin page account listing. Leave this field blank to disable the feature. This option only affects the creation of new accounts.</p>';266 $main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="add_accounts_to_one" method="post">';267 $main .= '<p><strong>Main Account ID:</strong> <input type="text" name="add_new_users_to_account" size="6" value="' . phoromatic_server::read_setting('add_new_users_to_account') . '" /></p>';268 $main .= '<p><input name="submit" value="Update Account Handling" type="submit" /></p>';269 $main .= '</form>';...
start_remote_gui_server.php
Source:start_remote_gui_server.php
...28 return false;29 }30 $server_launcher = '#!/bin/sh' . PHP_EOL;31 $web_port = 0;32 $remote_access = pts_config::read_user_config('PhoronixTestSuite/Options/Server/RemoteAccessPort', 'FALSE');33 $remote_access = is_numeric($remote_access) && $remote_access > 1 ? $remote_access : false;34 $blocked_ports = array(2049, 3659, 4045, 6000);35 if($remote_access)36 {37 // ALLOWING SERVER TO BE REMOTELY ACCESSIBLE38 $server_ip = '0.0.0.0';39 $fp = false;40 $errno = null;41 $errstr = null;42 if(($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false)43 {44 trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via ' . pts_config::get_config_file_location() . ' to proceed.', E_USER_ERROR);45 fclose($fp);46 return false;47 }48 else49 {50 $web_port = $remote_access;51 $web_socket_port = pts_config::read_user_config('PhoronixTestSuite/Options/Server/WebSocketPort', '');52 if($web_socket_port == null || !is_numeric($web_socket_port))53 {54 $web_socket_port = $web_port - 1;55 }56 }57 }58 else59 {60 echo PHP_EOL . PHP_EOL . 'You must first configure the remote GUI/WEBUI settings via:' . pts_config::get_config_file_location() . PHP_EOL . PHP_EOL;61 return false;62 }63 // WebSocket Server Setup64 $server_launcher .= 'export PTS_WEBSOCKET_PORT=' . $web_socket_port . PHP_EOL;65 $server_launcher .= 'export PTS_WEBSOCKET_SERVER=GUI' . PHP_EOL;...
read_user_config
Using AI Code Generation
1require_once('pts-config.php');2$conf = new pts_config();3$conf->read_user_config();4echo $conf->get_user_config('user_name');5echo $conf->get_user_config('user_email');6echo $conf->get_user_config('user_password');
read_user_config
Using AI Code Generation
1require_once('pts-config.php');2$pts_config = new pts_config();3$config = $pts_config->read_user_config();4require_once('pts-config.php');5$pts_config = new pts_config();6$config = $pts_config->read_system_config();7require_once('pts-config.php');8$pts_config = new pts_config();9$config = array(
read_user_config
Using AI Code Generation
1require_once('pts_config.php');2$conf=new pts_config();3echo $conf->read_user_config('user_name');4PHP Code: echo $conf->read_user_config('user_name');5require_once('pts_config.php');6$conf=new pts_config();7echo $conf->read_default_config('user_name');8PHP Code: echo $conf->read_default_config('user_name');9require_once('pts_config.php');10$conf=new pts_config();11echo $conf->read_config('user_name');12PHP Code: echo $conf->read_config('user_name');13require_once('pts_config.php');14$conf=new pts_config();15$conf->write_user_config('user_name','John');16PHP Code: echo $conf->read_user_config('user_name');17require_once('pts_config.php');18$conf=new pts_config();19$conf->write_default_config('user_name','John');20PHP Code: echo $conf->read_default_config('user_name');21require_once('pts_config.php');22$conf=new pts_config();23$conf->write_config('user_name','John');24PHP Code: echo $conf->read_config('user_name');25require_once('pts_config.php');26$conf=new pts_config();27$conf->delete_user_config('user_name');28PHP Code: echo $conf->read_user_config('user_name');29require_once('pts_config.php');30$conf=new pts_config();31$conf->delete_default_config('user_name');32PHP Code: echo $conf->read_default_config('user_name');
read_user_config
Using AI Code Generation
1require_once('pts-config.php');2$config = new pts_config();3$config->read_user_config();4echo $config->get_value('test');5echo $config->get_value('test1');6echo $config->get_value('test2');7require_once('pts-config.php');8$config = new pts_config();9$config->write_user_config();10require_once('pts-config.php');11$config = new pts_config();12$config->write_default_config();13require_once('pts-config.php');14$config = new pts_config();15$config->read_default_config();16echo $config->get_value('test');17echo $config->get_value('test1');18echo $config->get_value('test2');19require_once('pts-config.php');20$config = new pts_config();21echo $config->get_user_config_path();22require_once('pts-config.php');23$config = new pts_config();24echo $config->get_default_config_path();25require_once('pts-config.php');26$config = new pts_config();27echo $config->get_config_path();28require_once('pts-config.php');29$config = new pts_config();
read_user_config
Using AI Code Generation
1echo pts_config::read_user_config('system', 'user');2echo pts_config::read_user_config('system', 'user');3echo pts_config::read_user_config('system', 'user');4echo pts_config::read_user_config('system', 'user');5echo pts_config::read_user_config('system', 'user');6echo pts_config::read_user_config('system', 'user');7echo pts_config::read_user_config('system', 'user');
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with read_user_config on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!