Merge pull request #431 from xmujay/0609_monitor
[phpmyadmin/aamir.git] / server_status_advisor.php
blob219a4ee27a72b6619178433bffbbc3317b6d7e1c
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * displays the advisor feature
6 * @package PhpMyAdmin
7 */
9 require_once 'libraries/common.inc.php';
10 require_once 'libraries/Advisor.class.php';
11 require_once 'libraries/ServerStatusData.class.php';
12 if (PMA_DRIZZLE) {
13 $server_master_status = false;
14 $server_slave_status = false;
15 } else {
16 include_once 'libraries/replication.inc.php';
17 include_once 'libraries/replication_gui.lib.php';
20 $ServerStatusData = new PMA_ServerStatusData();
22 $response = PMA_Response::getInstance();
23 $scripts = $response->getHeader()->getScripts();
24 $scripts->addFile('server_status_advisor.js');
26 /**
27 * Output
29 $response->addHTML('<div>');
30 $response->addHTML($ServerStatusData->getMenuHtml());
31 $response->addHTML(PMA_getAdvisorHtml());
32 $response->addHTML('</div>');
33 exit;
36 /**
37 * Returns html with Advisor
39 * @return string
41 function PMA_getAdvisorHtml()
43 $output = '<a href="#openAdvisorInstructions">';
44 $output .= PMA_Util::getIcon('b_help.png', __('Instructions'));
45 $output .= '</a>';
46 $output .= '<div id="statustabs_advisor"></div>';
47 $output .= '<div id="advisorInstructionsDialog" style="display:none;">';
48 $output .= '<p>';
49 $output .= __(
50 'The Advisor system can provide recommendations '
51 . 'on server variables by analyzing the server status variables.'
53 $output .= '</p>';
54 $output .= '<p>';
55 $output .= __(
56 'Do note however that this system provides recommendations '
57 . 'based on simple calculations and by rule of thumb which may '
58 . 'not necessarily apply to your system.'
60 $output .= '</p>';
61 $output .= '<p>';
62 $output .= __(
63 'Prior to changing any of the configuration, be sure to know '
64 . 'what you are changing (by reading the documentation) and how '
65 . 'to undo the change. Wrong tuning can have a very negative '
66 . 'effect on performance.'
68 $output .= '</p>';
69 $output .= '<p>';
70 $output .= __(
71 'The best way to tune your system would be to change only one '
72 . 'setting at a time, observe or benchmark your database, and undo '
73 . 'the change if there was no clearly measurable improvement.'
75 $output .= '</p>';
76 $output .= '</div>';
77 $output .= '<div id="advisorData" style="display:none;">';
78 $advisor = new Advisor();
79 $output .= htmlspecialchars(
80 json_encode(
81 $advisor->run()
84 $output .= '</div>';
86 return $output;