server_status_variables.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Displays a list of server status variables
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. use PhpMyAdmin\Response;
  9. use PhpMyAdmin\Message;
  10. use PhpMyAdmin\Server\Status\Data;
  11. use PhpMyAdmin\Server\Status\Variables;
  12. require_once 'libraries/common.inc.php';
  13. require_once 'libraries/server_common.inc.php';
  14. require_once 'libraries/replication.inc.php';
  15. /**
  16. * flush status variables if requested
  17. */
  18. if (isset($_POST['flush'])) {
  19. $_flush_commands = array(
  20. 'STATUS',
  21. 'TABLES',
  22. 'QUERY CACHE',
  23. );
  24. if (in_array($_POST['flush'], $_flush_commands)) {
  25. $GLOBALS['dbi']->query('FLUSH ' . $_POST['flush'] . ';');
  26. }
  27. unset($_flush_commands);
  28. }
  29. $serverStatusData = new Data();
  30. $response = Response::getInstance();
  31. $header = $response->getHeader();
  32. $scripts = $header->getScripts();
  33. $scripts->addFile('server_status_variables.js');
  34. $scripts->addFile('vendor/jquery/jquery.tablesorter.js');
  35. $scripts->addFile('server_status_sorter.js');
  36. $response->addHTML('<div>');
  37. $response->addHTML($serverStatusData->getMenuHtml());
  38. if ($serverStatusData->dataLoaded) {
  39. $response->addHTML(Variables::getHtmlForFilter($serverStatusData));
  40. $response->addHTML(Variables::getHtmlForLinkSuggestions($serverStatusData));
  41. $response->addHTML(Variables::getHtmlForVariablesList($serverStatusData));
  42. } else {
  43. $response->addHTML(
  44. Message::error(
  45. __('Not enough privilege to view status variables.')
  46. )->getDisplay()
  47. );
  48. }
  49. $response->addHTML('</div>');
  50. exit;