public static function run($args) { $result_file = new pts_result_file($args[0]); $result_file_identifiers = $result_file->get_system_identifiers(); if (count($result_file_identifiers) < 2) { echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL; return false; } $extract_identifiers = pts_strings::comma_explode(pts_user_io::prompt_text_menu('Select the test run(s) to extract', $result_file_identifiers, true)); $remove_identifiers = array_diff($result_file_identifiers, $extract_identifiers); $result_file->remove_run($remove_identifiers); do { echo PHP_EOL . 'Enter new result file to extract to: '; $extract_to = pts_user_io::read_user_input(); $extract_to = pts_test_run_manager::clean_save_name($extract_to); } while (empty($extract_to)); pts_client::save_test_result($extract_to . '/composite.xml', $result_file->get_xml()); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $extract_to . '/index.html'); }
public static function run($r) { $result_file = new pts_result_file($r[0]); $result_file_identifiers = $result_file->get_system_identifiers(); if (count($result_file_identifiers) < 2) { echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL; return false; } $remove_identifiers = explode(',', pts_user_io::prompt_text_menu('Select the test run(s) to remove', $result_file_identifiers, true)); $result_file->remove_run($remove_identifiers); $result_dir = dirname($result_file->get_file_location()) . '/'; foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) { foreach ($remove_identifiers as $remove_identifier) { if (is_dir($result_dir . $dir_name . '/' . $remove_identifier)) { pts_file_io::delete($result_dir . $dir_name . '/' . $remove_identifier, null, true); } } } pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); pts_client::display_web_page($result_dir . '/index.html'); }