Advisor.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * functions for displaying server status sub item: advisor
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. namespace PhpMyAdmin\Server\Status;
  9. use PhpMyAdmin\Advisor as PmaAdvisor;
  10. use PhpMyAdmin\Util;
  11. use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
  12. /**
  13. * PhpMyAdmin\Server\Status\Advisor class
  14. *
  15. * @package PhpMyAdmin
  16. */
  17. class Advisor
  18. {
  19. /**
  20. * Returns html with PhpMyAdmin\Advisor
  21. *
  22. * @return string
  23. */
  24. public static function getHtml()
  25. {
  26. $output = '<a href="#openAdvisorInstructions">';
  27. $output .= Util::getIcon('b_help', __('Instructions'));
  28. $output .= '</a>';
  29. $output .= '<div id="statustabs_advisor"></div>';
  30. $output .= '<div id="advisorInstructionsDialog" class="hide">';
  31. $output .= '<p>';
  32. $output .= __(
  33. 'The Advisor system can provide recommendations '
  34. . 'on server variables by analyzing the server status variables.'
  35. );
  36. $output .= '</p>';
  37. $output .= '<p>';
  38. $output .= __(
  39. 'Do note however that this system provides recommendations '
  40. . 'based on simple calculations and by rule of thumb which may '
  41. . 'not necessarily apply to your system.'
  42. );
  43. $output .= '</p>';
  44. $output .= '<p>';
  45. $output .= __(
  46. 'Prior to changing any of the configuration, be sure to know '
  47. . 'what you are changing (by reading the documentation) and how '
  48. . 'to undo the change. Wrong tuning can have a very negative '
  49. . 'effect on performance.'
  50. );
  51. $output .= '</p>';
  52. $output .= '<p>';
  53. $output .= __(
  54. 'The best way to tune your system would be to change only one '
  55. . 'setting at a time, observe or benchmark your database, and undo '
  56. . 'the change if there was no clearly measurable improvement.'
  57. );
  58. $output .= '</p>';
  59. $output .= '</div>';
  60. $output .= '<div id="advisorData" class="hide">';
  61. $advisor = new PmaAdvisor($GLOBALS['dbi'], new ExpressionLanguage());
  62. $output .= htmlspecialchars(
  63. json_encode(
  64. $advisor->run()
  65. )
  66. );
  67. $output .= '</div>';
  68. return $output;
  69. }
  70. }