server_status_processes.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * displays the server status > processes list
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. use PhpMyAdmin\Response;
  9. use PhpMyAdmin\Server\Status\Data;
  10. use PhpMyAdmin\Server\Status\Processes;
  11. require_once 'libraries/common.inc.php';
  12. require_once 'libraries/server_common.inc.php';
  13. /**
  14. * Replication library
  15. */
  16. require_once 'libraries/replication.inc.php';
  17. $serverStatusData = new Data();
  18. $response = Response::getInstance();
  19. /**
  20. * Kills a selected process
  21. * on ajax request
  22. */
  23. if ($response->isAjax() && !empty($_POST['kill'])) {
  24. $kill = intval($_POST['kill']);
  25. $query = $GLOBALS['dbi']->getKillQuery($kill);
  26. if ($GLOBALS['dbi']->tryQuery($query)) {
  27. $message = PhpMyAdmin\Message::success(
  28. __('Thread %s was successfully killed.')
  29. );
  30. $response->setRequestStatus(true);
  31. } else {
  32. $message = PhpMyAdmin\Message::error(
  33. __(
  34. 'phpMyAdmin was unable to kill thread %s.'
  35. . ' It probably has already been closed.'
  36. )
  37. );
  38. $response->setRequestStatus(false);
  39. }
  40. $message->addParam($kill);
  41. $response->addJSON('message', $message);
  42. } elseif ($response->isAjax() && !empty($_POST['refresh'])) {
  43. // Only sends the process list table
  44. $response->addHTML(Processes::getHtmlForServerProcesslist());
  45. } else {
  46. // Load the full page
  47. $header = $response->getHeader();
  48. $scripts = $header->getScripts();
  49. $scripts->addFile('server_status_processes.js');
  50. $response->addHTML('<div>');
  51. $response->addHTML($serverStatusData->getMenuHtml());
  52. $response->addHTML(Processes::getHtmlForProcessListFilter());
  53. $response->addHTML(Processes::getHtmlForServerProcesslist());
  54. $response->addHTML(Processes::getHtmlForProcessListAutoRefresh());
  55. $response->addHTML('</div>');
  56. }
  57. exit;