/** * Prints server status information: processes, connections and traffic * * @param PMA_ServerStatusData $ServerStatusData Server status data * * @return string */ function PMA_getHtmlForServerStatus($ServerStatusData) { //display the server state General Information $retval = PMA_getHtmlForServerStateGeneralInfo($ServerStatusData); //display the server state traffic information $retval .= PMA_getHtmlForServerStateTraffic($ServerStatusData); //display the server state connection information $retval .= PMA_getHtmlForServerStateConnections($ServerStatusData); //display the server Process List information $retval .= PMA_getHtmlForServerProcesslist($ServerStatusData); return $retval; }
/** * Prints html for server status processes * * @return string */ function PMA_getHtmlForServerProcesses() { $notice = PMA_Message::notice(__('Note: Enabling the auto refresh here might cause ' . 'heavy traffic between the web server and the MySQL server.'))->getDisplay(); $retval = $notice . '<div class="tabLinks">'; $retval .= '<label>' . __('Refresh rate') . ': '; $retval .= PMA_ServerStatusData::getHtmlForRefreshList('refreshRate', 5, array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200)); $retval .= '</label>'; $retval .= '<a id="toggleRefresh" href="#">'; $retval .= PMA_Util::getImage('play.png') . __('Start auto refresh'); $retval .= '</a>'; $retval .= '</div>'; $retval .= PMA_getHtmlForServerProcesslist(); return $retval; }
/** * Test for PMA_getHtmlForServerProcesslist * * @return void * @group medium */ public function testPMAGetHtmlForServerProcessList() { $process = array("User" => "User1", "Host" => "Host1", "Id" => "Id1", "db" => "db1", "Command" => "Command1", "Info" => "Info1", "State" => "State1", "Time" => "Time1"); $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 12; $GLOBALS['dbi']->expects($this->any())->method('fetchAssoc')->will($this->onConsecutiveCalls($process)); $html = PMA_getHtmlForServerProcesslist(); // Test process table $this->assertContains('<table id="tableprocesslist" ' . 'class="data clearfloat noclick sortable">', $html); $this->assertContains('<th>Processes</th>', $html); $this->assertContains('Show Full Queries', $html); $this->assertContains('server_status_processes.php', $html); $_REQUEST['full'] = true; $_REQUEST['sort_order'] = 'ASC'; $_REQUEST['order_by_field'] = 'db'; $_REQUEST['column_name'] = 'Database'; $html = PMA_getHtmlForServerProcesslist(); $this->assertContains('Truncate Shown Queries', $html); $this->assertContains('Database', $html); $this->assertContains('DESC', $html); $_REQUEST['sort_order'] = 'DESC'; $_REQUEST['order_by_field'] = 'Host'; $_REQUEST['column_name'] = 'Host'; $html = PMA_getHtmlForServerProcesslist(); $this->assertContains('Host', $html); $this->assertContains('ASC', $html); }
/** * Kills a selected process * on ajax request */ if ($response->isAjax() && !empty($_REQUEST['kill'])) { $query = $GLOBALS['dbi']->getKillQuery((int) $_REQUEST['kill']); if ($GLOBALS['dbi']->tryQuery($query)) { $message = PMA_Message::success(__('Thread %s was successfully killed.')); $response->isSuccess(true); } else { $message = PMA_Message::error(__('phpMyAdmin was unable to kill thread %s.' . ' It probably has already been closed.')); $response->isSuccess(false); } $message->addParam($_REQUEST['kill']); $response->addJSON('message', $message); } elseif ($response->isAjax() && !empty($_REQUEST['refresh'])) { // Only sends the process list table $response->addHTML(PMA_getHtmlForServerProcessList()); } else { // Load the full page $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('server_status_processes.js'); $response->addHTML('<div>'); $response->addHTML($ServerStatusData->getMenuHtml()); $response->addHTML(PMA_getHtmlForProcessListFilter()); $response->addHTML(PMA_getHtmlForServerProcesslist()); $response->addHTML(PMA_getHtmlForProcessListAutoRefresh()); $response->addHTML('</div>'); } exit;