本文整理汇总了PHP中phoromatic_webui_header_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP phoromatic_webui_header_logged_in函数的具体用法?PHP phoromatic_webui_header_logged_in怎么用?PHP phoromatic_webui_header_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phoromatic_webui_header_logged_in函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_page_process
public static function render_page_process($PATH)
{
$suite_dir = phoromatic_server::phoromatic_account_suite_path($_SESSION['AccountID']);
$main = '<h1>Local Suites</h1><p>These are test suites created by you or another account within your group. Suites are an easy collection of test profiles. New suits can be trivially made via the <a href="/?build_suite">build suite</a> page.</p>';
$suite_count = 0;
foreach (pts_file_io::glob($suite_dir . '*/suite-definition.xml') as $xml_path) {
$suite_count++;
$id = basename(dirname($xml_path));
$test_suite = new pts_test_suite($xml_path);
$main .= '<a name="' . $id . '"></a><h1>' . $test_suite->get_title() . ' [' . $id . ']</h1>';
$main .= '<p><strong>' . $test_suite->get_maintainer() . '</strong></p>';
$main .= '<p><em>' . $test_suite->get_description() . '</em></p>';
$main .= '<div style="max-height: 200px; overflow-y: scroll;">';
foreach ($test_suite->get_contained_test_result_objects() as $tro) {
$main .= '<h3>' . $tro->test_profile->get_title() . ' [' . $tro->test_profile->get_identifier() . ']</h3>';
$main .= '<p>' . $tro->get_arguments_description() . '</p>';
}
$main .= '</div>';
$main .= '<hr />';
}
if ($suite_count == 0) {
$main .= '<h1>No Test Suites Found</h1>';
}
echo phoromatic_webui_header_logged_in();
echo '<div id="pts_phoromatic_main_area">' . $main . '</div>';
echo phoromatic_webui_footer();
}
示例2: render_page_process
public static function render_page_process($PATH)
{
echo phoromatic_webui_header_logged_in();
$main = '<h1>Systems</h1>';
$main .= '<p>Various system interaction vitals for the Phoronix Test Suite systems associated with this account.</p>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Hardware, Software, ClientVersion, LastIP, NetworkMAC, LastCommunication, CurrentTask, CoreVersion, NetworkWakeOnLAN, BlockPowerOffs FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY LastCommunication DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
while ($row = $result->fetchArray()) {
$stmt = phoromatic_server::$db->prepare('SELECT UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND SystemID = :system_id ORDER BY UploadTime DESC LIMIT 1');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $row['SystemID']);
$latest_result = $stmt->execute();
$latest_result = $latest_result->fetchArray();
$latest_result = $latest_result['UploadTime'];
$components[$row['SystemID']]['Last Communication'] = date('H:i d F', strtotime($row['LastCommunication']));
$components[$row['SystemID']]['Current Task'] = $row['CurrentTask'];
$components[$row['SystemID']]['Last IP'] = $row['LastIP'];
$components[$row['SystemID']]['Phoronix Test Suite'] = $row['ClientVersion'] . ' [' . $row['CoreVersion'] . ']';
$components[$row['SystemID']]['MAC'] = $row['NetworkMAC'];
$components[$row['SystemID']]['Wake-On-LAN'] = (empty($row['NetworkWakeOnLAN']) ? 'N/A' : $row['NetworkWakeOnLAN']) . ' - ' . ($row['BlockPowerOffs'] == 1 ? 'Blocked' : 'Permitted');
$components[$row['SystemID']]['Latest Result Upload'] = $latest_result != null ? date('d F', strtotime($latest_result)) : 'N/A';
$system_ids[$row['SystemID']] = $row['Title'];
}
$main .= '<div style="margin: 10px auto; overflow: auto;"><table width="100%">';
$component_types = array('Last Communication', 'Current Task', 'Phoronix Test Suite', 'Last IP', 'MAC', 'Wake-On-LAN', 'Latest Result Upload');
$main .= '<tr><th> </th>';
foreach ($component_types as $type) {
$main .= '<th>' . $type . '</th>';
}
foreach ($components as $system_id => $component_array) {
$main .= '<tr>';
$main .= '<th><a href="/?systems/' . $system_id . '">' . $system_ids[$system_id] . '</a></th>';
foreach ($component_types as $type) {
$c = isset($component_array[$type]) ? $component_array[$type] : 'N/A';
if (($x = stripos($c, ' @ ')) !== false) {
$c = substr($c, 0, $x);
}
if (($x = stripos($c, ' (')) !== false) {
$c = substr($c, 0, $x);
}
$main .= '<td>' . $c . '</td>';
}
$main .= '</tr>';
}
$main .= '</table></div>';
$right = null;
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in($right));
echo phoromatic_webui_footer();
}
示例3: render_page_process
public static function render_page_process($PATH)
{
if (isset($_POST['register_password']) && isset($_POST['register_password_confirm']) && isset($_POST['old_password'])) {
$matching_user = phoromatic_server::$db->querySingle('SELECT Password FROM phoromatic_users WHERE UserName = \'' . $_SESSION['UserName'] . '\' AND AccountID = \'' . $_SESSION['AccountID'] . '\'', true);
if (!empty($matching_user)) {
$hashed_password = $matching_user['Password'];
$account_salt = phoromatic_server::$db->querySingle('SELECT Salt FROM phoromatic_accounts WHERE AccountID = \'' . $_SESSION['AccountID'] . '\'');
if ($account_salt != null && hash('sha256', $account_salt . $_POST['old_password']) == $hashed_password) {
if (strlen($_POST['register_password']) < 6) {
phoromatic_error_page('Oops!', 'Please go back and ensure the supplied password is at least six characters long.');
return false;
}
if ($_POST['register_password'] != $_POST['register_password_confirm']) {
phoromatic_error_page('Oops!', 'Please go back and ensure the supplied password matches the password confirmation.');
return false;
}
$new_salted_password = hash('sha256', $account_salt . $_POST['register_password']);
phoromatic_server::$db->exec('UPDATE phoromatic_users SET Password = \'' . $new_salted_password . '\' WHERE UserName = "' . $_SESSION['UserName'] . '"');
echo '<h1>Password Updated!</h1>';
} else {
phoromatic_error_page('Oops!', 'The original password does not match the records for this account.');
return false;
}
} else {
phoromatic_error_page('Oops!', 'Problem fetching user information. Try again.');
return false;
}
}
echo phoromatic_webui_header_logged_in();
$main = '<h1>Change Password</h1>
<form name="reset_password" id="reset_password" action="?password" method="post" onsubmit="return phoromatic_password_reset(this);">
<div style="clear: both;">
<div style="float: left; font-weight: bold; padding-right: 10px;">
<p style="height: 50px;">Password</p>
<p style="height: 50px;">New Password</p>
<p style="height: 50px;">Confirm New Password</p>
</div>
<div style="float: left;">
<p style="height: 50px;"><input type="password" name="old_password" /></p>
<p style="height: 50px;"><input type="password" name="register_password" /> <sup>1</sup></p>
<p style="height: 50px;"><input type="password" name="register_password_confirm" /></p>
<p style="height: 50px;"><input type="submit" value="Change Password" /></p>
</div>
</div>
<p style="clear: both;"><sup>1</sup> Passwords shall be at least six characters long.</p>';
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
示例4: render_page_process
public static function render_page_process($PATH)
{
echo phoromatic_webui_header_logged_in();
$main = '<h1>System Components</h1>';
$main .= '<p>Detected hardware/software components via Phoronix Test Suite\'s Phodevi implementation on the Phoromatic client systems.</p>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Hardware, Software, ClientVersion, NetworkWakeOnLAN, NetworkMAC FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
while ($row = $result->fetchArray()) {
$components[$row['SystemID']] = array_merge(pts_result_file_analyzer::system_component_string_to_array($row['Software'], array('OS', 'Kernel', 'OpenGL', 'File-System')), pts_result_file_analyzer::system_component_string_to_array($row['Hardware'], array('Processor', 'Motherboard', 'Memory', 'Disk', 'Graphics')));
$components[$row['SystemID']]['Phoronix Test Suite'] = $row['ClientVersion'];
$components[$row['SystemID']]['WoL Info'] = $row['NetworkWakeOnLAN'];
$components[$row['SystemID']]['MAC'] = $row['NetworkMAC'];
$system_ids[$row['SystemID']] = $row['Title'];
}
$main .= '<div style="margin: 10px auto; overflow: auto;"><table>';
$component_types = array('MAC', 'Processor', 'Motherboard', 'Memory', 'Disk', 'Graphics', 'OS', 'Kernel', 'OpenGL', 'File-System', 'Phoronix Test Suite', 'WoL Info');
$main .= '<tr><th> </th>';
foreach ($component_types as $type) {
$main .= '<th>' . $type . '</th>';
}
foreach ($components as $system_id => $component_array) {
$main .= '<tr>';
$main .= '<th><a href="/?systems/' . $system_id . '">' . $system_ids[$system_id] . '</a></th>';
foreach ($component_types as $type) {
$c = isset($component_array[$type]) ? $component_array[$type] : 'N/A';
if (($x = stripos($c, ' @ ')) !== false) {
$c = substr($c, 0, $x);
}
if (($x = stripos($c, ' (')) !== false) {
$c = substr($c, 0, $x);
}
$main .= '<td>' . $c . '</td>';
}
$main .= '</tr>';
}
$main .= '</table></div>';
$right = null;
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in($right));
echo phoromatic_webui_footer();
}
示例5: render_page_process
public static function render_page_process($PATH)
{
echo phoromatic_webui_header_logged_in();
$main = '<h1>Cache Settings</h1>
<h2>Test Profile Download Cache</h2>
<p>Below are a list of files for verification/debugging purposes that are currently cached by the Phoromatic Server and available for Phoronix Test Suite client systems to download. These are files that are needed by various test profiles in the Phoronix Test Suite. To add more data to this Phoromatic Server cache, from the server run <strong>phoronix-test-suite make-download-cache</strong> while passing the names of any tests/suites you wish to have download and generate a cache for so they can be made available to the Phoronix Test Suite clients on your network.</p>';
$dc = pts_strings::add_trailing_slash(pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH)));
$dc_exists = is_file($dc . 'pts-download-cache.json');
if ($dc_exists) {
$cache_json = file_get_contents($dc . 'pts-download-cache.json');
$cache_json = json_decode($cache_json, true);
}
if (is_file($dc . 'pts-download-cache.json')) {
if ($cache_json && isset($cache_json['phoronix-test-suite']['download-cache'])) {
$total_file_size = 0;
$main .= '<table style="margin: 0 auto;"><tr><th>File</th><th>Size</th></tr>';
foreach ($cache_json['phoronix-test-suite']['download-cache'] as $file_name => $inf) {
$total_file_size += $cache_json['phoronix-test-suite']['download-cache'][$file_name]['file_size'];
$main .= '<tr><td>' . $file_name . '</td><td>' . round(max(0.1, $cache_json['phoronix-test-suite']['download-cache'][$file_name]['file_size'] / 1000000), 1) . 'MB</td></tr>';
}
$main .= '</table>';
$main .= '<p><strong>' . count($cache_json['phoronix-test-suite']['download-cache']) . ' Files / ' . round($total_file_size / 1000000) . ' MB Cache Size</strong></p>';
}
} else {
$main .= '<h3>No download cache file could be found; on the Phoromatic Server you should run <strong>phoronix-test-suite make-download-cache</strong>.</h3>';
// TODO XXX implement from the GUI
}
$main .= '<hr /><h2>OpenBenchmarking.org Cache Data</h2>';
$main .= '<p>Below is information pertaining to the OpenBenchmarking.org cache present on the Phoromatic Server. To update this cache, run <strong>phoronix-test-suite make-openbenchmarking-cache</strong> from the server.</p>';
$index_files = pts_file_io::glob(PTS_OPENBENCHMARKING_SCRATCH_PATH . '*.index');
$main .= '<table style="margin: 0 auto;"><tr><th>Repository</th><th>Last Updated</th></tr>';
foreach ($index_files as $index_file) {
$index_data = json_decode(file_get_contents($index_file), true);
$main .= '<tr><td>' . basename($index_file, '.index') . '</td><td>' . date('d F Y H:i', $index_data['main']['generated']) . '</td></tr>';
}
$main .= '</table>';
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
示例6: render_page_process
public static function render_page_process($PATH)
{
$main = null;
if (isset($PATH[0])) {
if ($PATH[0] == 'context' && isset($PATH[1])) {
$attribs = explode(',', $PATH[1]);
$stmt = phoromatic_server::$db->prepare('SELECT UserContextStep, UserContextLog FROM phoromatic_system_context_logs WHERE AccountID = :account_id AND ScheduleID = :schedule_id AND SystemID = :system_id AND TriggerID = :trigger_id ORDER BY UploadTime ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $attribs[0]);
$stmt->bindValue(':schedule_id', $attribs[1]);
$stmt->bindValue(':trigger_id', base64_decode($attribs[2]));
$result = $stmt->execute();
while ($row = $result->fetchArray()) {
$main .= '<h2>' . $row['UserContextStep'] . '</h2><p>' . str_replace(PHP_EOL, '<br />', $row['UserContextLog']) . '</p><hr />';
}
} else {
if ($PATH[0] == 'system' && isset($PATH[1])) {
$zip_file = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $PATH[1]) . 'system-logs.zip';
if (is_file($zip_file)) {
$zip = new ZipArchive();
$res = $zip->open($zip_file);
if ($res === true) {
for ($i = 0; $i < $zip->numFiles; $i++) {
if ($zip->getFromIndex($i) != null) {
$main .= '<h2>' . basename($zip->getNameIndex($i)) . '</h2><p>' . str_replace(PHP_EOL, '<br />', $zip->getFromIndex($i)) . '</p><hr />';
}
}
$zip->close();
}
}
}
}
}
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in(null));
echo phoromatic_webui_footer();
}
示例7: render_page_process
public static function render_page_process($PATH)
{
$main = '<h1>Recent Account Activity</h1>';
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_activity_stream WHERE AccountID = :account_id ORDER BY ActivityTime DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
$prev_date = null;
do {
if ($prev_date != substr($row['ActivityTime'], 0, 10)) {
if ($prev_date != null) {
$main .= '</p><hr />';
}
$prev_date = substr($row['ActivityTime'], 0, 10);
$new_date = strtotime($row['ActivityTime']);
if (date('Y-m-d') == $prev_date) {
$main .= '<h2>Today</h2>';
} else {
if ($new_date > time() - 60 * 60 * 24 * 6) {
$main .= '<h2>' . date('l', $new_date) . '</h2>';
} else {
$main .= '<h2>' . date('j F Y', $new_date) . '</h2>';
}
}
$main .= '<p>';
}
$id_link_format = $row['ActivityEventID'];
switch ($row['ActivityEvent']) {
case 'settings':
$event_link_format = '<a href="?settings">settings</a>';
break;
case 'users':
$event_link_format = '<a href="?users">a user</a>';
break;
case 'schedule':
$event_link_format = '<a href="?schedules">schedule</a>';
$stmt1 = phoromatic_server::$db->prepare('SELECT Title FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt1->bindValue(':account_id', $_SESSION['AccountID']);
$stmt1->bindValue(':schedule_id', $row['ActivityEventID']);
$result1 = $stmt1->execute();
$row1 = $result1->fetchArray();
$id_link_format = '<a href="?schedules/' . $row['ActivityEventID'] . '">' . $row1['Title'] . '</a>';
break;
case 'tests_for_schedule':
$event_link_format = 'a test for a schedule';
$stmt1 = phoromatic_server::$db->prepare('SELECT Title FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt1->bindValue(':account_id', $_SESSION['AccountID']);
$stmt1->bindValue(':schedule_id', $row['ActivityEventID']);
$result1 = $stmt1->execute();
$row1 = $result1->fetchArray();
$id_link_format = '<a href="?schedules/' . $row['ActivityEventID'] . '">' . $row1['Title'] . '</a>';
break;
case 'groups':
$event_link_format = '<a href="?systems#group_edit">a group</a>';
break;
default:
$event_link_format = $row['ActivityEvent'];
break;
}
if ($row['ActivityCreatorType'] == 'USER') {
$main .= '<em>' . date('H:i', strtotime($row['ActivityTime'])) . '</em> <strong>' . $row['ActivityCreator'] . '</strong> <strong> ' . $row['ActivityEventType'] . '</strong> <strong>' . $event_link_format . '</strong>';
if ($id_link_format != null) {
$main .= ': ' . $id_link_format;
}
$main .= '<br />' . PHP_EOL;
}
//$main .= '<p>' . $row['ActivityCreator'] . ' ' . $row['ActivityCreatorType'] . ' ' . $row['ActivityEvent'] . ' ' . $row['ActivityEventID'] . ' ' . $row['ActivityEventType'] . '</p>';
} while ($row = $result->fetchArray());
if ($prev_date != null) {
$main .= '</p>';
}
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main);
echo phoromatic_webui_footer();
}
示例8: render_page_process
public static function render_page_process($PATH)
{
$main = null;
$identifier_item = isset($PATH[1]) ? $PATH[0] . '/' . $PATH[1] : false;
if ($identifier_item && pts_test_profile::is_test_profile($identifier_item)) {
$tp = new pts_test_profile($identifier_item);
$tp_identifier = $tp->get_identifier(false);
$main .= '<h1>' . $tp->get_title() . '</h1><p>' . $tp->get_description() . '</p>';
$main .= '<p><strong>' . $tp->get_test_hardware_type() . ' - ' . phoromatic_server::test_result_count_for_test_profile($_SESSION['AccountID'], $tp_identifier) . ' Results On This Account - ' . $tp->get_test_software_type() . ' - Maintained By: ' . $tp->get_maintainer() . ' - Supported Platforms: ' . implode(', ', $tp->get_supported_platforms()) . '</strong></p>';
$main .= '<p><a href="http://openbenchmarking.org/test/' . $tp_identifier . '">Find out more about this test profile on OpenBenchmarking.org</a>.</p>';
$main .= '<h2>Recent Results With This Test</h2>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, PPRID FROM phoromatic_results WHERE AccountID = :account_id AND UploadID IN (SELECT DISTINCT UploadID FROM phoromatic_results_results WHERE AccountID = :account_id AND TestProfile LIKE :tp) ORDER BY UploadTime DESC LIMIT 30');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':tp', $tp_identifier . '%');
$result = $stmt->execute();
$recent_result_count = 0;
while ($result && ($row = $result->fetchArray())) {
$recent_result_count++;
$main .= '<h2><a href="/?result/' . $row['PPRID'] . '">' . $row['Title'] . '</a></h2>';
}
if ($recent_result_count == 0) {
$main .= '<p>No results found on this Phoromatic Server for the ' . $tp->get_title() . ' test profile.</p>';
} else {
if ($recent_result_count > 5) {
$stmt = phoromatic_server::$db->prepare('SELECT UploadID, SystemID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND UploadID IN (SELECT DISTINCT UploadID FROM phoromatic_results_results WHERE AccountID = :account_id AND TestProfile LIKE :tp) ORDER BY UploadTime DESC LIMIT 1000');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':tp', $tp_identifier . '%');
$result = $stmt->execute();
$recent_result_count = 0;
$result_file = new pts_result_file(null, true);
while ($result && ($row = $result->fetchArray())) {
$composite_xml = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'composite.xml';
if (!is_file($composite_xml)) {
continue;
}
// Add to result file
$system_name = strtotime($row['UploadTime']) . ': ' . phoromatic_server::system_id_to_name($row['SystemID']);
$sub_result_file = new pts_result_file($composite_xml, true);
foreach ($sub_result_file->get_result_objects() as $obj) {
if ($obj->test_profile->get_identifier(false) == $tp_identifier) {
$obj->test_result_buffer->rename(null, $system_name);
$result_file->add_result($obj);
}
}
}
$table = null;
$extra_attributes = array('multi_way_comparison_invert_default' => false);
$f = false;
foreach ($result_file->get_result_objects() as $obj) {
$obj->test_profile->set_display_format('SCATTER_PLOT');
foreach ($obj->test_result_buffer->buffer_items as $i => &$item) {
if (!is_numeric(substr($item->get_result_identifier(), 0, strpos($item->get_result_identifier(), ':')))) {
unset($obj->test_result_buffer->buffer_items[$i]);
}
}
$result_file = null;
$main .= '<p align="center">' . pts_render::render_graph_inline_embed($obj, $result_file, $extra_attributes) . '</p>';
}
}
}
} else {
$dc = pts_strings::add_trailing_slash(pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH)));
$dc_exists = is_file($dc . 'pts-download-cache.json');
if ($dc_exists) {
$cache_json = file_get_contents($dc . 'pts-download-cache.json');
$cache_json = json_decode($cache_json, true);
}
$test_counts_for_account = phoromatic_server::test_result_count_for_test_profiles($_SESSION['AccountID']);
foreach (pts_openbenchmarking::available_tests() as $test) {
$cache_checked = false;
if ($dc_exists) {
if ($cache_json && isset($cache_json['phoronix-test-suite']['cached-tests'])) {
$cache_checked = true;
if (!in_array($test, $cache_json['phoronix-test-suite']['cached-tests'])) {
//continue;
}
}
}
if (!$cache_checked && phoromatic_server::read_setting('show_local_tests_only') && pts_test_install_request::test_files_in_cache($test, true, true) == false) {
continue;
}
$tp = new pts_test_profile($test);
if ($tp->get_title() == null) {
continue;
}
$test_count = 0;
$tpid = $tp->get_identifier(false);
foreach ($test_counts_for_account as $test => $count) {
if (strpos($test, $tpid) !== false) {
$test_count += $count;
unset($test_counts_for_account[$test]);
}
}
$main .= '<h1 style="margin-bottom: 0;"><a href="/?tests/' . $tp->get_identifier(false) . '">' . $tp->get_title() . '</a></h1>';
$main .= '<p style="font-size: 90%;"><strong>' . $tp->get_test_hardware_type() . '</strong> <em>-</em> ' . $test_count . ' Results On This Account' . ' </p>';
}
}
echo phoromatic_webui_header_logged_in();
echo '<div id="pts_phoromatic_main_area">' . $main . '</div>';
echo phoromatic_webui_footer();
//.........这里部分代码省略.........
示例9: render_page_process
public static function render_page_process($PATH)
{
if (isset($_POST['suite_title'])) {
// echo '<pre>';
// var_dump($_POST);
// echo '</pre>';
if (strlen($_POST['suite_title']) < 3) {
echo '<h2>Suite title must be at least three characters.</h2>';
}
//echo 'TEST SUITE: ' . $_POST['suite_title'] . '<br />';
//echo 'TEST SUITE: ' . $_POST['suite_description'] . '<br />';
$tests = array();
foreach ($_POST['test_add'] as $i => $test_identifier) {
$test_prefix = $_POST['test_prefix'][$i];
$args = array();
$args_name = array();
foreach ($_POST as $i => $v) {
if (strpos($i, $test_prefix) !== false && substr($i, -9) != '_selected') {
if (strpos($v, '||') !== false) {
$opts = explode('||', $v);
$a = array();
$d = array();
foreach ($opts as $opt) {
$t = explode('::', $opt);
array_push($a, $t[1]);
array_push($d, $t[0]);
}
array_push($args, $a);
array_push($args_name, $d);
} else {
array_push($args, array($v));
array_push($args_name, array($_POST[$i . '_selected']));
}
}
}
$test_args = array();
$test_args_description = array();
pts_test_run_options::compute_all_combinations($test_args, null, $args, 0);
pts_test_run_options::compute_all_combinations($test_args_description, null, $args_name, 0, ' - ');
foreach (array_keys($test_args) as $i) {
array_push($tests, array('test' => $test_identifier, 'description' => $test_args_description[$i], 'args' => $test_args[$i]));
}
}
if (count($tests) < 1) {
echo '<h2>You must add at least one test to the suite.</h2>';
}
$suite_writer = new pts_test_suite_writer();
$version_bump = 0;
do {
$suite_version = '1.' . $version_bump . '.0';
$suite_id = $suite_writer->clean_save_name_string($_POST['suite_title']) . '-' . $suite_version;
$suite_dir = phoromatic_server::phoromatic_account_suite_path($_SESSION['AccountID'], $suite_id);
$version_bump++;
} while (is_dir($suite_dir));
pts_file_io::mkdir($suite_dir);
$save_to = $suite_dir . '/suite-definition.xml';
$suite_writer->add_suite_information($_POST['suite_title'], $suite_version, $_SESSION['UserName'], 'System', $_POST['suite_description']);
foreach ($tests as $m) {
$suite_writer->add_to_suite($m['test'], $m['args'], $m['description']);
}
$suite_writer->save_xml($save_to);
echo '<h2>Saved As ' . $suite_id . '</h2>';
}
echo phoromatic_webui_header_logged_in();
$main = '<h1>Local Suites</h1><p>Find already created local test suites by your account/group via the <a href="/?local_suites">local suites</a> page.</p>';
if (!PHOROMATIC_USER_IS_VIEWER) {
$main .= '<h1>Build Suite</h1><p>A test suite in the realm of the Phoronix Test Suite, OpenBenchmarking.org, and Phoromatic is <strong>a collection of test profiles with predefined settings</strong>. Establishing a test suite makes it easy to run repetitive testing on the same set of test profiles by simply referencing the test suite name.</p>';
$main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="build_suite" id="build_suite" method="post" onsubmit="return validate_suite();">
<h3>Title:</h3>
<p><input type="text" name="suite_title" /></p>
<h3>Description:</h3>
<p><textarea name="suite_description" id="suite_description" cols="60" rows="2"></textarea></p>
<h3>Tests In Schedule:</h3>
<p><div id="test_details"></div></p>
<h3>Add Another Test</h3>';
$main .= '<select name="add_to_suite_select_test" id="add_to_suite_select_test" onchange="phoromatic_build_suite_test_details();">';
$dc = pts_strings::add_trailing_slash(pts_client::parse_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH)));
$dc_exists = is_file($dc . 'pts-download-cache.json');
foreach (pts_openbenchmarking::available_tests(false, true) as $test) {
$cache_checked = false;
if ($dc_exists) {
$cache_json = file_get_contents($dc . 'pts-download-cache.json');
$cache_json = json_decode($cache_json, true);
if ($cache_json && isset($cache_json['phoronix-test-suite']['cached-tests'])) {
$cache_checked = true;
if (!in_array($test, $cache_json['phoronix-test-suite']['cached-tests'])) {
continue;
}
}
}
if (!$cache_checked && phoromatic_server::read_setting('show_local_tests_only') && pts_test_install_request::test_files_in_cache($test, true, true) == false) {
continue;
}
$main .= '<option value="' . $test . '">' . $test . '</option>';
}
$main .= '</select>';
$main .= '<p align="right"><input name="submit" value="Create Suite" type="submit" onclick="return pts_rmm_validate_suite();" /></p>';
}
echo '<div id="pts_phoromatic_main_area">' . $main . '</div>';
echo phoromatic_webui_footer();
//.........这里部分代码省略.........
示例10: render_page_process
//.........这里部分代码省略.........
if (!empty($row)) {
$right .= '<h3><a href="?schedules/' . $row['ScheduleID'] . '">' . $row['Title'] . '</a></h3>';
if (!empty($row['ActiveOn'])) {
$right .= '<p align="center"><strong>' . phoromatic_schedule_activeon_string($row['ActiveOn'], $row['RunAt']) . '</strong></p>';
}
$right .= '<p>Compare this result file to the latest results from the past: ';
$right .= '<select name="view_results_from_past" id="view_results_from_past" onchange="phoromatic_jump_to_results_from(\'' . $row['ScheduleID'] . '\', \'view_results_from_past\', \'' . $PATH[0] . ',\');">';
$oldest_upload_time = strtotime(phoromatic_oldest_result_for_schedule(self::$schedule_id));
$opts = array('Week' => 7, 'Three Weeks' => 21, 'Month' => 30, 'Quarter' => 90, 'Six Months' => 180, 'Year' => 365);
foreach ($opts as $str_name => $time_offset) {
if ($oldest_upload_time > time() - 86400 * $time_offset) {
break;
}
$right .= '<option value="' . $time_offset . '">' . $str_name . '</option>';
}
$right .= '<option value="all">All Results</option>';
$right .= '</select>';
$right .= '</p>';
}
}
if (true) {
$compare_results = array();
$hash_matches = 0;
$ticket_matches = 0;
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND ComparisonHash = :comparison_hash AND PPRID NOT IN (:pprid) ORDER BY UploadTime DESC LIMIT 12');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':comparison_hash', $result_file->get_contained_tests_hash(false));
$stmt->bindValue(':pprid', implode(',', $upload_ids));
$result = $stmt->execute();
while ($row = $result->fetchArray()) {
$compare_results[$row['PPRID']] = $row;
$hash_matches++;
}
foreach ($benchmark_tickets as $ticket_id) {
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND BenchmarkTicketID = :ticket_id AND PPRID NOT IN (:pprid) ORDER BY UploadTime DESC LIMIT 12');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':ticket_id', $ticket_id);
$stmt->bindValue(':pprid', implode(',', $upload_ids));
$result = $stmt->execute();
while ($row = $result->fetchArray()) {
$compare_results[$row['PPRID']] = $row;
$ticket_matches++;
}
}
if (!empty($compare_results)) {
$right .= '<hr /><h3>Compare Results</h3><form name="compare_similar_results" onsubmit="return false;">
<input type="hidden" value="' . implode(',', $upload_ids) . '" id="compare_similar_results_this" />';
foreach ($compare_results as &$row) {
$right .= '<p><input type="checkbox" value="' . $row['PPRID'] . '" name="compare_results" /> ' . $row['Title'] . '<br /><em>' . phoromatic_system_id_to_name($row['SystemID'], $row['AccountID']) . '</em></p>';
}
$right .= '<p><input type="submit" value="Compare Results" id="compare_results_submit" onclick="javascript:phoromatic_do_custom_compare_results(this); return false;" /></p></form>';
if ($ticket_matches > 3) {
$right .= '<p><a href="/results/ticket/' . $ticket_id . '">Find All Matching Results</a>';
} else {
if ($hash_matches > 3) {
$right .= '<p><a href="/results/hash/' . $result_file->get_contained_tests_hash(false) . '">Find All Matching Results</a>';
}
}
}
}
if (count($upload_ids) > 1) {
$checkbox_options = array('normalize_results' => 'Normalize Results', 'sort_by_performance' => 'Sort Results By Performance', 'sort_by_name' => 'Reverse Result By Identifier', 'sort_by_reverse' => 'Reverse Result Order', 'show_only_changed_results' => 'Show Only Results With Result Variation', 'force_line_graph' => 'Force Line Graph');
if ($result_file->is_multi_way_comparison()) {
$checkbox_options['condense_comparison'] = 'Condense Comparison';
$checkbox_options['transpose_comparison'] = 'Transpose Comparison';
}
$right .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_result_view" method="post"><hr /><h3>Result Analysis Options</h3><p align="left">' . PHP_EOL;
foreach ($checkbox_options as $val => $name) {
$right .= '<input type="checkbox" name="' . $val . '" value="1" ' . (isset($_POST[$val]) ? 'checked="checked" ' : null) . '/> ' . $name . '<br />';
}
$right .= '<br /><input type="submit" value="Refresh Results"></p></form>';
}
if (self::$schedule_id && !empty(self::$schedule_id) && $system_types[0] && $trigger_types[0]) {
$stmt = phoromatic_server::$db->prepare('SELECT UserContextStep FROM phoromatic_system_context_logs WHERE AccountID = :account_id AND ScheduleID = :schedule_id AND SystemID = :system_id AND TriggerID = :trigger_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $system_types[0]);
$stmt->bindValue(':schedule_id', self::$schedule_id);
$stmt->bindValue(':trigger_id', $trigger_types[0]);
$result = $stmt->execute();
if ($row = $result->fetchArray()) {
$right .= '<hr /><h3>User Context Logs</h3>';
do {
$right .= '<p><a href="?logs/context/' . $system_types[0] . ',' . self::$schedule_id . ',' . base64_encode($trigger_types[0]) . '">' . $row['UserContextStep'] . '</a></p>';
} while ($row = $result->fetchArray());
}
}
$right .= '<hr /><h3>Result Export</h3>';
$right .= '<p><a href="/public.php?t=result&ut=' . implode(',', $upload_ids) . $url_append . '">Public Viewer</a></p>';
$right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=pdf' . $url_append . '">Download As PDF</a></p>';
$right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=csv">Download As CSV</a></p>';
$right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=xml">Download As XML</a></p>';
$right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=txt">Download As TEXT</a></p>';
$right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&upload_to_openbenchmarking">Upload To OpenBenchmarking.org</a></p>';
if (is_file(phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'system-logs.zip')) {
$right .= '<hr /><p><a href="?logs/system/' . $row['UploadID'] . '">View System Logs</a></p>';
}
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in($right));
echo phoromatic_webui_footer();
}
示例11: render_page_process
public static function render_page_process($PATH)
{
$main = null;
echo phoromatic_webui_header_logged_in();
if (!empty($PATH[0]) && is_numeric($PATH[0])) {
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$result = $stmt->execute();
$row = $result->fetchArray();
if (empty($row)) {
$main = '<h1>Test Schedules</h1>';
$main .= '<h3>No Resource Found</h3>';
} else {
if (!PHOROMATIC_USER_IS_VIEWER) {
if (isset($_POST['add_to_schedule_select_test'])) {
$name = $_POST['add_to_schedule_select_test'];
$args = array();
$args_name = array();
foreach ($_POST as $i => $v) {
if (substr($i, 0, 12) == 'test_option_' && substr($i, -9) != '_selected') {
array_push($args, $v);
array_push($args_name, $_POST[$i . '_selected']);
}
}
$args_name = implode(' - ', $args_name);
$args = implode(' ', $args);
if (!empty($name)) {
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_schedules_tests (AccountID, ScheduleID, TestProfile, TestArguments, TestDescription) VALUES (:account_id, :schedule_id, :test_profile, :test_arguments, :test_description)');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$stmt->bindValue(':test_profile', $name);
$stmt->bindValue(':test_arguments', $args);
$stmt->bindValue(':test_description', $args_name);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('tests_for_schedule', $PATH[0], 'added');
}
} else {
if (isset($PATH[1]) && $PATH[1] == 'remove' && !empty($PATH[2])) {
// REMOVE TEST
$to_remove = explode(PHP_EOL, base64_decode($PATH[2]));
$stmt = phoromatic_server::$db->prepare('DELETE FROM phoromatic_schedules_tests WHERE AccountID = :account_id AND ScheduleID = :schedule_id AND TestProfile = :test AND TestArguments = :test_args');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$stmt->bindValue(':test', $to_remove[0]);
$stmt->bindValue(':test_args', $to_remove[1]);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('tests_for_schedule', $to_remove[0] . ' - ' . $to_remove[1], 'removed');
} else {
if (isset($PATH[1]) && $PATH[1] == 'delete-trigger' && !empty($PATH[2])) {
// REMOVE TRIGGER
$trigger = base64_decode($PATH[2]);
$stmt = phoromatic_server::$db->prepare('DELETE FROM phoromatic_schedules_triggers WHERE AccountID = :account_id AND Trigger = :trigger AND ScheduleID = :schedule_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$stmt->bindValue(':trigger', $trigger);
$result = $stmt->execute();
if ($result) {
$main .= '<h2 style="color: red;">Trigger Removed: ' . $trigger . '</h2>';
}
} else {
if (isset($PATH[1]) && in_array($PATH[1], array('activate', 'deactivate'))) {
switch ($PATH[1]) {
case 'deactivate':
$new_state = 0;
break;
case 'activate':
default:
$new_state = 1;
break;
}
// REMOVE TEST
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_schedules SET State = :new_state WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$stmt->bindValue(':new_state', $new_state);
$result = $stmt->execute();
$row['State'] = $new_state;
phoromatic_add_activity_stream_event('schedule', $PATH[0], $PATH[1]);
} else {
if (isset($_POST['do_manual_test_run'])) {
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_schedules_triggers (AccountID, ScheduleID, Trigger, TriggeredOn) VALUES (:account_id, :schedule_id, :trigger, :triggered_on)');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$stmt->bindValue(':trigger', $_SESSION['UserName'] . ' - Manual Test Run - ' . date('H:i j M Y'));
$stmt->bindValue(':triggered_on', phoromatic_server::current_time());
$stmt->execute();
$main .= '<h2 style="color: red;">Manual Test Run Triggered</h2>';
} else {
if (isset($_POST['skip_current_ticket'])) {
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_schedules_trigger_skips (AccountID, ScheduleID, Trigger) VALUES (:account_id, :schedule_id, :trigger)');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$stmt->bindValue(':trigger', date('Y-m-d'));
$stmt->execute();
$main .= '<h2 style="color: red;">Current Trigger To Be Ignored</h2>';
}
}
}
}
//.........这里部分代码省略.........
示例12: render_page_process
//.........这里部分代码省略.........
$stats['Total Schedule Count'] = $row['ScheduleCount'];
$stmt = phoromatic_server::$db->prepare('SELECT COUNT(UploadID) AS ResultCount FROM phoromatic_results');
$result = $stmt->execute();
$row = $result->fetchArray();
$stats['Total Result Count'] = $row['ResultCount'];
$stmt = phoromatic_server::$db->prepare('SELECT COUNT(ActivityTime) AS ActivityCount FROM phoromatic_activity_stream');
$stmt->bindValue(':today_date', date('Y-m-d') . '%');
$result = $stmt->execute();
$row = $result->fetchArray();
$stats['Total Activity Count'] = $row['ActivityCount'];
$main .= '<p>';
foreach ($stats as $what => $c) {
$main .= '<strong>' . $what . ':</strong> ' . $c . '<br />';
}
$main .= '<hr /><h2>Account Topology</h2>';
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_users ORDER BY AccountID,AdminLevel ASC');
$result = $stmt->execute();
$plevel = -1;
$user_list = array();
while ($row = $result->fetchArray()) {
switch ($row['AdminLevel']) {
case 1:
$level = 'Group Administrator';
$offset = null;
break;
case 2:
$level = 'Administrator';
$offset = str_repeat('-', 10);
break;
case 3:
$level = 'Power User';
$offset = str_repeat('-', 20);
break;
case 10:
$level = 'Viewer';
$offset = str_repeat('-', 30);
break;
default:
if ($row['AdminLevel'] < 1) {
$level = 'Disabled';
} else {
$level = 'Unknown';
}
$offset = null;
break;
}
if ($row['AdminLevel'] == 1) {
if ($plevel != -1) {
$main .= '</p>';
}
$main .= '<p>';
}
$main .= $offset . ' <strong>' . $row['UserName'] . '</strong> (<em>' . $level . '</em>) <strong>Created On:</strong> ' . phoromatic_user_friendly_timedate($row['CreatedOn']) . ' <strong>Last Log-In:</strong> ' . ($row['LastLogin'] != null ? phoromatic_user_friendly_timedate($row['LastLogin']) : 'N/A') . ($row['AdminLevel'] == 1 ? ' [<strong>ACCOUNT ID:</strong> ' . $row['AccountID'] . ']' : null) . '<br />';
$plevel = $row['AdminLevel'];
$user_list[$row['UserName']] = $row['AdminLevel'];
}
if ($plevel != -1) {
$main .= '</p>';
}
$main .= '<hr /><h2>Disable Account</h2>';
$main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="disable_user" id="disable_user" method="post"><p><select name="disable_user">';
foreach ($user_list as $user_name => $user_level) {
if ($user_level > 0) {
$main .= '<option value="' . $user_name . '">' . $user_name . '</option>';
}
}
$main .= '</select></p><p><input name="submit" value="Disable User" type="submit" /></p></form>';
$main .= '<hr /><h2>Create New Account Group</h2>';
$main .= '<form name="register_form" id="register_form" action="?admin" method="post" onsubmit="return phoromatic_initial_registration(this);">
<h3>Username</h3>
<p><input type="text" name="register_username" /> <sup>1</sup></p>
<h3>Password</h3>
<p><input type="password" name="register_password" /> <sup>2</sup></p>
<h3>Confirm Password</h3>
<p><input type="password" name="register_password_confirm" /></p>
<h3>Email</h3>
<p><input type="text" name="register_email" /> <sup>3</sup></p>
<h3>Account ID</h3>
<p><input type="text" name="seed_accountid" /> <sup>4</sup></p>
<p><input type="submit" value="Create Account" /></p>
</form>
<p style="font-size: 11px;"><sup>1</sup> Usernames shall be at least four characters long, not contain any spaces, and only be composed of normal ASCII characters.<br />
<sup>2</sup> Passwords shall be at least six characters long.<br />
<sup>3</sup> A valid email address is required for notifications, password reset, and other verification purposes.<br />
<sup>4</sup> The account ID field is optional and is used to pre-seed the account identifier for advanced purposes. The field must be six characters. Leave this field blank if you are unsure.<br />
</p>';
//
$server_log = explode(PHP_EOL, file_get_contents(getenv('PTS_PHOROMATIC_LOG_LOCATION')));
foreach ($server_log as $i => $line_item) {
if (strpos($line_item, '[200]') !== false || strpos($line_item, '[302]') !== false) {
unset($server_log[$i]);
}
}
$server_log = implode(PHP_EOL, $server_log);
$main .= '<hr /><h2>Phoromatic Server Log</h2>';
$main .= '<p><textarea style="width: 80%; height: 400px;">' . $server_log . '</textarea></p>';
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
示例13: render_page_process
public static function render_page_process($PATH)
{
if (PHOROMATIC_USER_IS_VIEWER) {
return;
}
$is_new = true;
if (!empty($PATH[0]) && is_numeric($PATH[0])) {
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$result = $stmt->execute();
$e_schedule = $result->fetchArray();
if (!empty($e_schedule)) {
$is_new = false;
}
}
if (isset($_POST['schedule_title']) && !empty($_POST['schedule_title'])) {
$title = phoromatic_get_posted_var('schedule_title');
$description = phoromatic_get_posted_var('schedule_description');
$pre_install_context = phoromatic_get_posted_var('pre_install_set_context');
$post_install_context = phoromatic_get_posted_var('post_install_set_context');
$pre_run_context = phoromatic_get_posted_var('pre_run_set_context');
$post_run_context = phoromatic_get_posted_var('post_run_set_context');
$system_all = phoromatic_get_posted_var('system_all');
$run_target_systems = phoromatic_get_posted_var('run_on_systems', array());
$run_target_groups = phoromatic_get_posted_var('run_on_groups', array());
if (!is_array($run_target_systems)) {
$run_target_systems = array();
}
if (!is_array($run_target_groups)) {
$run_target_groups = array();
}
$run_target_systems = implode(',', $run_target_systems);
$run_target_groups = implode(',', $run_target_groups);
$schedule_hour = phoromatic_get_posted_var('schedule_hour');
$schedule_minute = phoromatic_get_posted_var('schedule_minute');
$days_active = phoromatic_get_posted_var('days_active');
$context_files = array('SetContextPreInstall' => 'pre_install_set_context', 'SetContextPostInstall' => 'post_install_set_context', 'SetContextPreRun' => 'pre_run_set_context', 'SetContextPostRun' => 'post_run_set_context');
foreach ($context_files as $i => $context) {
${$context} = $is_new ? null : $e_schedule[$i];
}
foreach ($context_files as $context) {
${$context} = null;
if ($_FILES[$context]['error'] == 0 && $_FILES[$context]['size'] > 0) {
$sha1_hash = sha1_file($_FILES[$context]['tmp_name']);
if (!is_file(phoromatic_server::phoromatic_account_path($_SESSION['AccountID']) . 'context_' . $sha1_hash)) {
move_uploaded_file($_FILES[$context]['tmp_name'], phoromatic_server::phoromatic_account_path($_SESSION['AccountID']) . 'context_' . $sha1_hash);
}
${$context} = $sha1_hash;
}
}
// TODO XXX: Validation of input
// Need a unique schedule ID
if ($is_new) {
do {
$schedule_id = rand(10, 9999);
$matching_schedules = phoromatic_server::$db->querySingle('SELECT ScheduleID FROM phoromatic_schedules WHERE AccountID = \'' . $_SESSION['AccountID'] . '\' AND ScheduleID = \'' . $schedule_id . '\'');
} while (!empty($matching_schedules));
// Need a unique public ID
do {
$public_key = pts_strings::random_characters(12, true);
$matching_schedules = phoromatic_server::$db->querySingle('SELECT ScheduleID FROM phoromatic_schedules WHERE AccountID = \'' . $_SESSION['AccountID'] . '\' AND PublicKey = \'' . $public_key . '\'');
} while (!empty($matching_schedules));
} else {
$schedule_id = $e_schedule['ScheduleID'];
$public_key = $e_schedule['PublicKey'];
}
// Add schedule
$stmt = phoromatic_server::$db->prepare('INSERT OR REPLACE INTO phoromatic_schedules (AccountID, ScheduleID, Title, Description, State, ActiveOn, RunAt, SetContextPreInstall, SetContextPostInstall, SetContextPreRun, SetContextPostRun, LastModifiedBy, LastModifiedOn, PublicKey, RunTargetGroups, RunTargetSystems) VALUES (:account_id, :schedule_id, :title, :description, :state, :active_on, :run_at, :context_pre_install, :context_post_install, :context_pre_run, :context_post_run, :modified_by, :modified_on, :public_key, :run_target_groups, :run_target_systems)');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $schedule_id);
$stmt->bindValue(':title', $title);
$stmt->bindValue(':description', $description);
$stmt->bindValue(':state', 1);
$stmt->bindValue(':active_on', implode(',', $days_active));
$stmt->bindValue(':run_at', $schedule_hour . '.' . $schedule_minute);
$stmt->bindValue(':context_pre_install', $pre_install_set_context);
$stmt->bindValue(':context_post_install', $post_install_set_context);
$stmt->bindValue(':context_pre_run', $pre_run_set_context);
$stmt->bindValue(':context_post_run', $post_run_set_context);
$stmt->bindValue(':modified_by', $_SESSION['UserName']);
$stmt->bindValue(':modified_on', phoromatic_server::current_time());
$stmt->bindValue(':public_key', $public_key);
$stmt->bindValue(':run_target_groups', $run_target_groups);
$stmt->bindValue(':run_target_systems', $run_target_systems);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('schedule', $schedule_id, $is_new ? 'added' : 'modified');
if ($result) {
header('Location: ?schedules/' . $schedule_id);
}
}
echo phoromatic_webui_header_logged_in();
$main = '
<hr />
<h2>' . ($is_new ? 'Create' : 'Edit') . ' A Schedule</h2>
<p>A test schedule is used to facilitate automatically running a set of test(s)/suite(s) on either a routine timed basis or whenever triggered by an external script or process, e.g. Git/VCS commit, manually triggered, etc.</p>';
$main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="add_test" id="add_test" method="post" enctype="multipart/form-data" onsubmit="return validate_schedule();">
<h3>Title:</h3>
<p><input type="text" name="schedule_title" value="' . (!$is_new ? $e_schedule['Title'] : null) . '" /></p>
<h3><sup>1</sup> Pre-Install Set Context Script:</h3>
//.........这里部分代码省略.........
示例14: render_page_process
//.........这里部分代码省略.........
if ($results == 0) {
$main .= '<li class="light" style="text-align: center;">No Results Found</li>';
}
$main .= '</ul></div>';
$main .= '</div>';
$main .= '<hr /><h1>Schedules</h1>';
$main .= '<h2>Active Test Schedules</h2>';
$main .= '<div class="pts_phoromatic_info_box_area">
<ul>
<li><h1>Active Test Schedules</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, Description, RunTargetSystems, RunTargetGroups, RunAt, ActiveOn, AccountID FROM phoromatic_schedules WHERE State >= 1 ORDER BY Title ASC');
$result = $stmt->execute();
$row = $result->fetchArray();
if ($row == false) {
$main .= '<li class="light" style="text-align: center;">No Schedules Found</li>';
} else {
do {
$main .= '<a onclick=""><li>' . $row['Title'] . '<br /><table><tr><td>' . phoromatic_account_id_to_group_name($row['AccountID']) . '</td><td>' . pts_strings::plural_handler(count(phoromatic_server::systems_associated_with_schedule($row['AccountID'], $row['ScheduleID'])), 'System') . '</td><td><strong>' . phoromatic_schedule_activeon_string($row['ActiveOn'], $row['RunAt']) . '</strong></td><td><a onclick="return confirm(\'Permanently remove this schedule?\');" href="/?admin_data/delete/schedule/' . $row['AccountID'] . '/' . $row['ScheduleID'] . '">Permanently Remove</a></td></tr></table></li></a>';
} while ($row = $result->fetchArray());
}
$main .= '</ul></div>';
$main .= '<hr /><h2>Inactive Test Schedules</h2>';
$main .= '<div class="pts_phoromatic_info_box_area">
<ul>
<li><h1>Active Test Schedules</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, Description, RunTargetSystems, RunTargetGroups, RunAt, ActiveOn, AccountID FROM phoromatic_schedules WHERE State < 1 ORDER BY Title ASC');
$result = $stmt->execute();
$row = $result->fetchArray();
if ($row == false) {
$main .= '<li class="light" style="text-align: center;">No Schedules Found</li>';
} else {
do {
$main .= '<a onclick=""><li>' . $row['Title'] . '<br /><table><tr><td>' . phoromatic_account_id_to_group_name($row['AccountID']) . '</td><td>' . pts_strings::plural_handler(count(phoromatic_server::systems_associated_with_schedule($row['AccountID'], $row['ScheduleID'])), 'System') . '</td><td><strong>' . phoromatic_schedule_activeon_string($row['ActiveOn'], $row['RunAt']) . '</strong></td><td><a onclick="return confirm(\'Permanently remove this schedule?\');" href="/?admin_data/delete/schedule/' . $row['AccountID'] . '/' . $row['ScheduleID'] . '">Permanently Remove</a></td></tr></table></li></a>';
} while ($row = $result->fetchArray());
}
$main .= '</ul></div>';
$main .= '<hr /><h2>Schedule Triggers</h2>';
$main .= '<div class="pts_phoromatic_info_box_area">
<ul>
<li><h1>Triggers</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Trigger, TriggeredOn, AccountID, ScheduleID FROM phoromatic_schedules_triggers ORDER BY TriggeredOn DESC');
$result = $stmt->execute();
$row = $result->fetchArray();
if ($row == false) {
$main .= '<li class="light" style="text-align: center;">No Triggers Found</li>';
} else {
do {
$main .= '<a onclick=""><li>' . $row['Trigger'] . '<br /><table><tr><td>' . $row['TriggeredOn'] . '</td><td>' . phoromatic_account_id_to_group_name($row['AccountID']) . '</td><td><a onclick="return confirm(\'Permanently remove this trigger?\');" href="/?admin_data/delete/trigger/' . $row['AccountID'] . '/' . $row['ScheduleID'] . '/' . $row['Trigger'] . '">Permanently Remove</a></td></tr></table></li></a>';
} while ($row = $result->fetchArray());
}
$main .= '</ul></div>';
$main .= '<hr /><h1>Systems</h1>
<h2>Active Systems</h2>
<div class="pts_phoromatic_info_box_area">
<ul>
<li><h1>Active Systems</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, LocalIP, CurrentTask, LastCommunication, EstimatedTimeForTask, TaskPercentComplete, AccountID FROM phoromatic_systems WHERE State >= 0 ORDER BY LastCommunication DESC');
$result = $stmt->execute();
$row = $result->fetchArray();
$active_system_count = 0;
if ($row == false) {
$main .= '<li class="light" style="text-align: center;">No Systems Found</li>';
} else {
do {
$main .= '<a onclick=""><li>' . $row['Title'] . '<br /><table><tr><td>' . phoromatic_account_id_to_group_name($row['AccountID']) . '</td><td>' . $row['LocalIP'] . '</td><td><strong>' . $row['CurrentTask'] . '</strong></td><td><strong>Last Communication:</strong> ' . date('j F Y H:i', strtotime($row['LastCommunication'])) . '</td><td><a onclick="return confirm(\'Permanently remove this system?\');" href="/?admin_data/delete/system/' . $row['AccountID'] . '/' . $row['SystemID'] . '">Permanently Remove</a></td></tr></table></li></a>';
$active_system_count++;
} while ($row = $result->fetchArray());
}
$main .= '</ul></div>';
$main .= '<h2>Inactive Systems</h2>
<div class="pts_phoromatic_info_box_area">
<ul>
<li><h1>Inactive Systems</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, LocalIP, CurrentTask, LastCommunication, EstimatedTimeForTask, TaskPercentComplete, AccountID FROM phoromatic_systems WHERE State < 0 ORDER BY LastCommunication DESC');
$result = $stmt->execute();
$row = $result->fetchArray();
$active_system_count = 0;
if ($row == false) {
$main .= '<li class="light" style="text-align: center;">No Systems Found</li>';
} else {
do {
$main .= '<a onclick=""><li>' . $row['Title'] . '<br /><table><tr><td>' . phoromatic_account_id_to_group_name($row['AccountID']) . '</td><td>' . $row['LocalIP'] . '</td><td><strong>' . $row['CurrentTask'] . '</strong></td><td><strong>Last Communication:</strong> ' . date('j F Y H:i', strtotime($row['LastCommunication'])) . '</td><td><a onclick="return confirm(\'Permanently remove this system?\');" href="/?admin_data/delete/system/' . $row['AccountID'] . '/' . $row['SystemID'] . '">Permanently Remove</a></td></tr></table></li></a>';
$active_system_count++;
} while ($row = $result->fetchArray());
}
$main .= '</ul></div>';
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_benchmark_tickets ORDER BY TicketIssueTime DESC');
$result = $stmt->execute();
$main .= '<hr /><h1>Benchmark Tickets</h1>
<div class="pts_phoromatic_info_box_area"><ul><li><h1>Tickets</h1></li>';
while ($result && ($row = $result->fetchArray())) {
$main .= '<a onclick=""><li>' . $row['Title'] . '<br /><table><tr><td><a onclick="return confirm(\'Permanently remove this system?\');" href="/?admin_data/delete/ticket/' . $row['AccountID'] . '/' . $row['TicketID'] . '">Permanently Remove</a></td></tr></table></li></a>';
}
$main .= '</ul></div>';
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
示例15: render_page_process
//.........这里部分代码省略.........
<h3>Test Run Identifier:</h3>
<p>The test run identifier is the per-system name for the system(s) being benchmarked. The following variables may be used: <strong>.SYSTEM</strong>, <strong>.GROUP</strong>. Any custom per-user system variables set via the individual system pages can also be used.</p>
<p><input type="text" name="benchmark_identifier" value="' . (!$is_new ? $e_schedule['Identifier'] : null) . '" /></p>
<h3>Test Suite To Run:</h3>
<p><a href="?build_suite">Build a suite</a> to add/select more tests to run or <a href="?local_suites">view local suites</a> for more information on a particular suite. A test suite is a set of test profiles to run in a pre-defined manner.</p>';
$main .= '<p><select name="suite_to_run">';
foreach ($local_suites as $xml_path) {
$id = basename(dirname($xml_path));
$test_suite = new pts_test_suite($xml_path);
$main .= '<option value="' . $id . '">' . $test_suite->get_title() . ' - ' . $id . '</option>';
}
$main .= '</select></p>';
$main .= '<h3>Description:</h3>
<p>The description is an optional way to add more details about the intent or objective of this test run.</p>
<p><textarea name="benchmark_description" id="benchmark_description" cols="50" rows="3">' . (!$is_new ? $e_schedule['Description'] : null) . '</textarea></p>
<hr /><h3>System Targets:</h3>
<p>Select the systems that should be benchmarked at their next earliest convenience.</p>
<p style="white-space: nowrap;">';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
if (!$is_new) {
$e_schedule['RunTargetSystems'] = explode(',', $e_schedule['RunTargetSystems']);
$e_schedule['RunTargetGroups'] = explode(',', $e_schedule['RunTargetGroups']);
}
if ($row = $result->fetchArray()) {
$main .= '<h4>Systems: ';
do {
$main .= '<input type="checkbox" name="run_on_systems[]" value="' . $row['SystemID'] . '" ' . (!$is_new && in_array($row['SystemID'], $e_schedule['RunTargetSystems']) ? 'checked="checked" ' : null) . '/> ' . $row['Title'] . ' ';
} while ($row = $result->fetchArray());
$main .= '</h4>';
}
$stmt = phoromatic_server::$db->prepare('SELECT GroupName FROM phoromatic_groups WHERE AccountID = :account_id ORDER BY GroupName ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
if ($row = $result->fetchArray()) {
$main .= '<h4>Groups: ';
do {
$main .= '<input type="checkbox" name="run_on_groups[]" value="' . $row['GroupName'] . '" ' . (!$is_new && in_array($row['GroupName'], $e_schedule['RunTargetGroups']) ? 'checked="checked" ' : null) . '/> ' . $row['GroupName'] . ' ';
} while ($row = $result->fetchArray());
$main .= '</h4>';
}
$main .= '</p>
<hr /><h3>Environment Options</h3>
<h4>Stress Testing</h4>
<p>If you wish to test systems for stability/reliability rather than performance, use this option and specify the number of tests to run concurrently (two or more) and (optionally) for the total period of time to continue looping the benchmarks. These options are intended to just stress the system and will not record any benchmark results. From the command-line this testing mode can be used via the <em>phoronix-test-suite stress-run</em> sub-command.</p>
<p><strong>Concurrent Number Of Test Processes:</strong> <select name="PTS_CONCURRENT_TEST_RUNS"><option value="0">Disabled</option>';
for ($i = 2; $i <= 24; $i++) {
$main .= '<option value="' . $i . '">' . $i . '</option>';
}
$main .= '</select></p>
<p><strong>Force Loop Time:</strong> <select name="TOTAL_LOOP_TIME"><option value="0">Disabled</option>';
$s = true;
for ($i = 60; $i <= 60 * 24 * 90; $i += 60) {
if ($i > 10080) {
// 7 days
if ($i % 1440 != 0) {
continue;
}
} else {
if ($i > 480) {
$s = !$s;
if (!$s) {
continue;
}
}
}
$main .= '<option value="' . $i . '">' . pts_strings::format_time($i, 'MINUTES') . '</option>';
}
$main .= '</select></p>
<h4>System Monitoring</h4>
<p>The Phoronix Test Suite system monitor module allows for select hardware/software sensors to be logged in real-time while running the selected test suite. The supported sensors are then shown within the result file upon the test\'s completion.</p>';
foreach (phodevi::available_sensors() as $sensor) {
$main .= '<input type="checkbox" name="MONITOR" value="' . phodevi::sensor_identifier($sensor) . '" /> ' . phodevi::sensor_name($sensor) . ' ';
}
$main .= '<hr /><p align="left"><input name="submit" value="' . ($is_new ? 'Run' : 'Edit') . ' Benchmark" type="submit" onclick="return pts_rmm_validate_schedule();" /></p>
</form>';
}
}
}
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_benchmark_tickets WHERE AccountID = :account_id AND State >= 0 AND TicketIssueTime > :time_cutoff ORDER BY TicketIssueTime DESC LIMIT 30');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':time_cutoff', time() - 60 * 60 * 24 * 14);
$result = $stmt->execute();
$right = '<ul><li>Benchmark Tickets</li>';
if ($result) {
$row = $result->fetchArray();
if (!empty($row)) {
do {
$right .= '<li><a href="?benchmark/' . $row['TicketID'] . '">' . $row['Title'] . '</a></li>';
} while ($row = $result->fetchArray());
}
}
$right .= '<li><em><a href="?benchmark/all">View All Past Tickets</a></em></li>';
$right .= '</ul>';
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in($right));
echo phoromatic_webui_footer();
}