本文整理汇总了PHP中pts_client::user_home_directory方法的典型用法代码示例。如果您正苦于以下问题:PHP pts_client::user_home_directory方法的具体用法?PHP pts_client::user_home_directory怎么用?PHP pts_client::user_home_directory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pts_client
的用法示例。
在下文中一共展示了pts_client::user_home_directory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run($r)
{
$result_file = new pts_result_file($r[0]);
$result_output = pts_result_file_output::result_file_to_csv($result_file);
// To save the result:
$file = pts_client::user_home_directory() . $r[0] . '.csv';
file_put_contents($file, $result_output);
echo $result_output;
}
示例2: pts_define_directories
function pts_define_directories()
{
// User's home directory for storing results, module files, test installations, etc.
pts_define('PTS_CORE_PATH', PTS_PATH . 'pts-core/');
pts_define('PTS_IS_DAEMONIZED_SERVER_PROCESS', PTS_IS_CLIENT && is_dir('/var/lib/') && is_writable('/') ? true : false);
if (PTS_IS_DAEMONIZED_SERVER_PROCESS) {
if (!is_dir('/var/cache/phoronix-test-suite/')) {
mkdir('/var/cache/phoronix-test-suite/');
}
pts_define('PTS_USER_PATH', '/var/lib/phoronix-test-suite/');
pts_define('PTS_CORE_STORAGE', PTS_USER_PATH . 'core.pt2so');
pts_define('PTS_TEMP_STORAGE', PTS_USER_PATH . 'temp.pt2so');
pts_define('PTS_MODULE_LOCAL_PATH', PTS_USER_PATH . 'modules/');
pts_define('PTS_MODULE_DATA_PATH', PTS_USER_PATH . 'modules-data/');
pts_define('PTS_DOWNLOAD_CACHE_PATH', '/var/cache/phoronix-test-suite/download-cache/');
pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', '/var/cache/phoronix-test-suite/openbenchmarking.org/');
pts_define('PTS_TEST_PROFILE_PATH', PTS_USER_PATH . 'test-profiles/');
pts_define('PTS_TEST_SUITE_PATH', PTS_USER_PATH . 'test-suites/');
pts_define('PTS_RESULTS_VIEWER_PATH', PTS_CORE_PATH . 'results-viewer/');
} else {
if (PTS_IS_CLIENT) {
pts_define('PTS_USER_PATH', pts_client::user_home_directory() . '.phoronix-test-suite' . DIRECTORY_SEPARATOR);
pts_define('PTS_CORE_STORAGE', PTS_USER_PATH . 'core.pt2so');
pts_define('PTS_TEMP_STORAGE', PTS_USER_PATH . 'temp.pt2so');
pts_define('PTS_MODULE_LOCAL_PATH', PTS_USER_PATH . 'modules/');
pts_define('PTS_MODULE_DATA_PATH', PTS_USER_PATH . 'modules-data/');
pts_define('PTS_DOWNLOAD_CACHE_PATH', PTS_USER_PATH . 'download-cache/');
pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', PTS_USER_PATH . 'openbenchmarking.org/');
pts_define('PTS_TEST_PROFILE_PATH', PTS_USER_PATH . 'test-profiles/');
pts_define('PTS_TEST_SUITE_PATH', PTS_USER_PATH . 'test-suites/');
pts_define('PTS_RESULTS_VIEWER_PATH', PTS_CORE_PATH . 'results-viewer/');
} else {
if (defined('PTS_STORAGE_PATH')) {
pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', PTS_STORAGE_PATH . 'openbenchmarking.org/');
pts_define('PTS_TEST_PROFILE_PATH', PTS_STORAGE_PATH . 'test-profiles/');
pts_define('PTS_TEST_SUITE_PATH', PTS_STORAGE_PATH . 'test-suites/');
} else {
if (defined('PATH_TO_PHOROMATIC_STORAGE')) {
pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', PATH_TO_PHOROMATIC_STORAGE . 'openbenchmarking.org/');
pts_define('PTS_TEST_PROFILE_PATH', PATH_TO_PHOROMATIC_STORAGE . 'test-profiles/');
pts_define('PTS_TEST_SUITE_PATH', PATH_TO_PHOROMATIC_STORAGE . 'test-suites/');
}
}
}
}
// Misc Locations
pts_define('PTS_MODULE_PATH', PTS_CORE_PATH . 'modules/');
pts_define('PTS_CORE_STATIC_PATH', PTS_CORE_PATH . 'static/');
pts_define('PTS_COMMAND_PATH', PTS_CORE_PATH . 'commands/');
pts_define('PTS_EXDEP_PATH', PTS_CORE_PATH . 'external-test-dependencies/');
pts_define('PTS_OPENBENCHMARKING_PATH', PTS_CORE_PATH . 'openbenchmarking.org/');
}
示例3: run
public static function run($r)
{
$_REQUEST['force_format'] = 'PNG';
// Force to PNG renderer
$_REQUEST['svg_dom_gd_no_interlacing'] = true;
// Otherwise FPDF will fail
$tdir = pts_client::create_temporary_directory();
pts_client::generate_result_file_graphs($r[0], $tdir);
$result_file = new pts_result_file($r[0]);
$pdf = new pts_pdf_template($result_file->get_title(), null);
$pdf->AddPage();
$pdf->Image(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', 69, 85, 73, 38);
$pdf->Ln(120);
$pdf->WriteStatementCenter('www.phoronix-test-suite.com');
$pdf->Ln(15);
$pdf->WriteBigHeaderCenter($result_file->get_title());
$pdf->WriteText($result_file->get_description());
$pdf->AddPage();
$pdf->Ln(15);
$pdf->SetSubject($result_file->get_title() . ' Benchmarks');
//$pdf->SetKeywords(implode(', ', $identifiers));
$pdf->WriteHeader('Test Systems:');
foreach ($result_file->get_systems() as $s) {
$pdf->WriteMiniHeader($s->get_identifier());
$pdf->WriteText($s->get_hardware());
$pdf->WriteText($s->get_software());
//$pdf->WriteText($notes_r[$i]);
}
/*
if(count($identifiers) > 1 && is_file($tdir . 'result-graphs/overview.jpg'))
{
$pdf->AddPage();
$pdf->Ln(100);
$pdf->Image($tdir . 'result-graphs/overview.jpg', 15, 40, 180);
}
*/
$pdf->AddPage();
$placement = 1;
$results = $result_file->get_result_objects();
for ($i = 1; $i <= count($results); $i++) {
if (is_file($tdir . 'result-graphs/' . $i . '.png')) {
$pdf->Ln(100);
$pdf->Image($tdir . 'result-graphs/' . $i . '.png', 50, 40 + ($placement - 1) * 120, 120);
}
if ($placement == 2) {
$placement = 0;
if ($i != count($results)) {
$pdf->AddPage();
}
}
$placement++;
}
// To save:
/*
$pdf_file = 'SAVE_TO';
if(substr($pdf_file, -4) != '.pdf')
{
$pdf_file .= '.pdf';
}
*/
$pdf_file = pts_client::user_home_directory() . $r[0] . '.pdf';
$pdf->Output($pdf_file);
pts_file_io::delete($tdir, null, true);
echo PHP_EOL . 'Saved To: ' . $pdf_file . PHP_EOL;
}
示例4: parse_home_directory
public static function parse_home_directory($path)
{
// Find home directory if needed
if (strpos($path, '~/') !== false) {
$path = str_replace('~/', pts_client::user_home_directory(), $path);
}
return pts_strings::add_trailing_slash($path);
}
示例5: run_matisk
//.........这里部分代码省略.........
echo PHP_EOL . 'The result_identifier field cannot be left empty when saving the test results.' . PHP_EOL;
return false;
}
*/
}
if (!empty($ini['environmental_variables']) && is_array($ini['environmental_variables'])) {
foreach ($ini['environmental_variables'] as $key => $value) {
putenv(trim($key) . '=' . trim($value));
}
}
if (empty($ini['set_context']['context'])) {
$ini['set_context']['context'] = array($ini['workload']['result_identifier']);
}
if (pts_strings::string_bool($ini['set_context']['log_context_outputs'])) {
pts_file_io::mkdir(pts_module::save_dir() . $ini['workload']['save_name']);
}
$spent_context_file = pts_module::save_dir() . $ini['workload']['save_name'] . '.spent-contexts';
if (!is_file($spent_context_file)) {
touch($spent_context_file);
} else {
// If recovering from an existing run, don't rerun contexts that were already executed
$spent_contexts = pts_file_io::file_get_contents($spent_context_file);
$spent_contexts = explode(PHP_EOL, $spent_contexts);
foreach ($spent_contexts as $sc) {
if (($key = array_search($sc, $ini['set_context']['context'])) !== false) {
unset($ini['set_context']['context'][$key]);
}
}
}
if ($ini['set_context']['reboot_support'] && phodevi::is_linux()) {
// In case a set-context involves a reboot, auto-recover
$xdg_config_home = is_dir('/etc/xdg/autostart') && is_writable('/etc/xdg/autostart') ? '/etc/xdg/autostart' : pts_client::read_env('XDG_CONFIG_HOME');
if ($xdg_config_home == false) {
$xdg_config_home = pts_client::user_home_directory() . '.config';
}
if ($xdg_config_home != false && is_dir($xdg_config_home)) {
$autostart_dir = $xdg_config_home . '/autostart/';
pts_file_io::mkdir($xdg_config_home . '/autostart/');
}
file_put_contents($xdg_config_home . '/autostart/phoronix-test-suite-matisk.desktop', '
[Desktop Entry]
Name=Phoronix Test Suite Matisk Recovery
GenericName=Phoronix Test Suite
Comment=Matisk Auto-Recovery Support
Exec=gnome-terminal -e \'phoronix-test-suite matisk ' . $args[0] . '\'
Icon=phoronix-test-suite
Type=Application
Encoding=UTF-8
Categories=System;Monitor;');
}
if ($ini['installation']['block_phodevi_caching']) {
// Block Phodevi caching if changing out system components and there is a chance one of the strings of changed contexts might be cached (e.g. OpenGL user-space driver)
phodevi::$allow_phodevi_caching = false;
}
if (phodevi::system_uptime() < 60) {
echo PHP_EOL . 'Sleeping 45 seconds while waiting for the system to settle...' . PHP_EOL;
sleep(45);
}
self::$ini = $ini;
$total_context_count = count(self::$ini['set_context']['context']);
while (($context = array_shift(self::$ini['set_context']['context'])) !== null) {
echo PHP_EOL . ($total_context_count - count(self::$ini['set_context']['context'])) . ' of ' . $total_context_count . ' in test execution queue [' . $context . ']' . PHP_EOL . PHP_EOL;
self::$context = $context;
if (pts_strings::string_bool(self::$ini['installation']['install_check']) || $ini['set_context']['pre_install'] != null) {
self::process_user_config_external_hook_process('pre_install');
$force_install = false;
示例6: setup_test_install_directory
protected static function setup_test_install_directory(&$test_install_request, $remove_old_files = false)
{
$identifier = $test_install_request->test_profile->get_identifier();
pts_file_io::mkdir($test_install_request->test_profile->get_install_dir());
if ($remove_old_files) {
// Remove any (old) files that were installed
$ignore_files = array('pts-install.xml', 'install-failed.log');
foreach ($test_install_request->get_download_objects() as $download_object) {
array_push($ignore_files, $download_object->get_filename());
}
pts_file_io::delete($test_install_request->test_profile->get_install_dir(), $ignore_files);
}
pts_file_io::symlink(pts_client::user_home_directory() . '.Xauthority', $test_install_request->test_profile->get_install_dir() . '.Xauthority');
pts_file_io::symlink(pts_client::user_home_directory() . '.drirc', $test_install_request->test_profile->get_install_dir() . '.drirc');
}
示例7: run
public static function run($r)
{
$is_moscow = pts_flags::os_identifier_hash() == 'b28d6a7148b34595c5b397dfcf5b12ac7932b3dc';
if ($is_moscow) {
// Auto mount?
$drives = pts_file_io::glob('/dev/sda*');
sort($drives);
if (false && count($drives) > 0 && !is_dir('/media/pts-auto-mount') && is_writable('/media/')) {
$last_drive = array_pop($drives);
echo PHP_EOL . 'Attempting to auto-mount drive: ' . $last_drive . PHP_EOL;
mkdir('/media/pts-auto-mount');
exec('mount ' . $last_drive . ' /media/pts-auto-mount');
putenv('PTS_TEST_INSTALL_ROOT_PATH=/media/pts-auto-mount/');
}
// Auto save results
$test_results_name = phodevi::read_property('motherboard', 'serial-number');
if ($test_results_name == null) {
$test_results_name = phodevi::read_name('motherboard');
}
if ($test_results_name == null) {
$test_results_name = phodevi::read_property('system', 'vendor-identifier');
}
putenv('TEST_RESULTS_NAME=' . str_replace(' ', null, $test_results_name));
putenv('TEST_RESULTS_IDENTIFIER=' . $test_results_name);
putenv('TEST_RESULTS_DESCRIPTION=Tests using ' . phodevi::read_property('system', 'operating-system') . ' on ' . date('d F Y') . ' of ' . $test_results_name . '.');
self::select_drive_mount();
}
pts_openbenchmarking::refresh_repository_lists();
pts_client::$display->generic_heading('Interactive Benchmarking');
echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL;
$reboot_on_exit = pts_flags::is_live_cd() && pts_client::user_home_directory() == '/root/';
do {
$options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition');
if ($is_moscow) {
unset($options['RUN_SUITE']);
// $options['SELECT_DRIVE_MOUNT'] = 'Select Disk Drive To Use For Testing';
}
if (count(pts_client::saved_test_results()) > 0) {
$options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage';
}
$options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit';
$response = pts_user_io::prompt_text_menu('Select Task', $options, false, true);
switch ($response) {
case 'RUN_TEST':
$supported_tests = pts_openbenchmarking::available_tests();
$supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true);
$longest_title_length = 0;
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile->get_title() == null || pts_test_run_manager::test_profile_system_compatibility_check($test_profile) == false) {
unset($supported_tests[$i]);
continue;
}
if ($is_moscow && pts_test_install_request::test_files_available_locally($test_profile) == false) {
// Don't show tests where files need to be downloaded
unset($supported_tests[$i]);
continue;
}
$longest_title_length = max($longest_title_length, strlen($test_profile->get_title()));
}
$t = array();
foreach ($supported_tests as $i => &$test_profile) {
if ($test_profile instanceof pts_test_profile) {
$t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type());
}
}
$supported_tests = $t;
asort($supported_tests);
$tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true);
$tests_to_run = explode(',', $tests_to_run);
pts_test_installer::standard_install($tests_to_run);
$run_manager = pts_test_run_manager::standard_run($tests_to_run, pts_c::defaults_mode | pts_c::auto_mode);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'RUN_SUITE':
$possible_suites = pts_openbenchmarking::available_suites();
foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) {
array_push($possible_suites, 'pts/' . $subsystem);
}
$suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true);
foreach (explode(',', $suites_to_run) as $suite_to_run) {
pts_test_installer::standard_install($suite_to_run);
pts_test_run_manager::standard_run($suite_to_run, pts_c::defaults_mode | pts_c::auto_mode);
}
break;
case 'SELECT_DRIVE_MOUNT':
self::select_drive_mount();
break;
case 'RUN_SYSTEM_TEST':
pts_client::$display->generic_heading('System Test');
$system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark');
pts_test_installer::standard_install($system_tests);
$run_manager = pts_test_run_manager::standard_run($system_tests, pts_c::defaults_mode | pts_c::auto_mode);
if ($run_manager != false) {
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true);
}
break;
case 'SHOW_INFO':
pts_client::$display->generic_heading('System Software / Hardware Information');
//.........这里部分代码省略.........