PageRenderTime 61ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/phpmyadmin/server_status.php

https://bitbucket.org/adarshj/convenient_website
PHP | 1814 lines | 1468 code | 197 blank | 149 comment | 153 complexity | 17fa8f1ea8e4afb659192941d7da6208 MD5 | raw file
Possible License(s): Apache-2.0, MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-2-Clause, GPL-2.0, LGPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * displays status variables with descriptions and some hints an optmizing
  5. * + reset status variables
  6. *
  7. * @package PhpMyAdmin
  8. */
  9. /**
  10. * no need for variables importing
  11. * @ignore
  12. */
  13. if (! defined('PMA_NO_VARIABLES_IMPORT')) {
  14. define('PMA_NO_VARIABLES_IMPORT', true);
  15. }
  16. if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
  17. $GLOBALS['is_header_sent'] = true;
  18. }
  19. require_once './libraries/common.inc.php';
  20. /**
  21. * Ajax request
  22. */
  23. if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
  24. // Send with correct charset
  25. header('Content-Type: text/html; charset=UTF-8');
  26. // real-time charting data
  27. if (isset($_REQUEST['chart_data'])) {
  28. switch($_REQUEST['type']) {
  29. // Process and Connections realtime chart
  30. case 'proc':
  31. $c = PMA_DBI_fetch_result("SHOW GLOBAL STATUS WHERE Variable_name = 'Connections'", 0, 1);
  32. $result = PMA_DBI_query('SHOW PROCESSLIST');
  33. $num_procs = PMA_DBI_num_rows($result);
  34. $ret = array(
  35. 'x' => microtime(true) * 1000,
  36. 'y_proc' => $num_procs,
  37. 'y_conn' => $c['Connections']
  38. );
  39. exit(json_encode($ret));
  40. // Query realtime chart
  41. case 'queries':
  42. if (PMA_DRIZZLE) {
  43. $sql = "SELECT concat('Com_', variable_name), variable_value
  44. FROM data_dictionary.GLOBAL_STATEMENTS
  45. WHERE variable_value > 0
  46. UNION
  47. SELECT variable_name, variable_value
  48. FROM data_dictionary.GLOBAL_STATUS
  49. WHERE variable_name = 'Questions'";
  50. $queries = PMA_DBI_fetch_result($sql, 0, 1);
  51. } else {
  52. $queries = PMA_DBI_fetch_result(
  53. "SHOW GLOBAL STATUS
  54. WHERE (Variable_name LIKE 'Com_%' OR Variable_name = 'Questions')
  55. AND Value > 0", 0, 1
  56. );
  57. }
  58. cleanDeprecated($queries);
  59. // admin commands are not queries
  60. unset($queries['Com_admin_commands']);
  61. $questions = $queries['Questions'];
  62. unset($queries['Questions']);
  63. //$sum=array_sum($queries);
  64. $ret = array(
  65. 'x' => microtime(true) * 1000,
  66. 'y' => $questions,
  67. 'pointInfo' => $queries
  68. );
  69. exit(json_encode($ret));
  70. // Traffic realtime chart
  71. case 'traffic':
  72. $traffic = PMA_DBI_fetch_result(
  73. "SHOW GLOBAL STATUS
  74. WHERE Variable_name = 'Bytes_received'
  75. OR Variable_name = 'Bytes_sent'", 0, 1
  76. );
  77. $ret = array(
  78. 'x' => microtime(true) * 1000,
  79. 'y_sent' => $traffic['Bytes_sent'],
  80. 'y_received' => $traffic['Bytes_received']
  81. );
  82. exit(json_encode($ret));
  83. // Data for the monitor
  84. case 'chartgrid':
  85. $ret = json_decode($_REQUEST['requiredData'], true);
  86. $statusVars = array();
  87. $serverVars = array();
  88. $sysinfo = $cpuload = $memory = 0;
  89. $pName = '';
  90. /* Accumulate all required variables and data */
  91. // For each chart
  92. foreach ($ret as $chart_id => $chartNodes) {
  93. // For each data series
  94. foreach ($chartNodes as $node_id => $nodeDataPoints) {
  95. // For each data point in the series (usually just 1)
  96. foreach ($nodeDataPoints as $point_id => $dataPoint) {
  97. $pName = $dataPoint['name'];
  98. switch ($dataPoint['type']) {
  99. /* We only collect the status and server variables here to
  100. * read them all in one query, and only afterwards assign them.
  101. * Also do some white list filtering on the names
  102. */
  103. case 'servervar':
  104. if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
  105. $serverVars[] = $pName;
  106. }
  107. break;
  108. case 'statusvar':
  109. if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
  110. $statusVars[] = $pName;
  111. }
  112. break;
  113. case 'proc':
  114. $result = PMA_DBI_query('SHOW PROCESSLIST');
  115. $ret[$chart_id][$node_id][$point_id]['value'] = PMA_DBI_num_rows($result);
  116. break;
  117. case 'cpu':
  118. if (!$sysinfo) {
  119. include_once 'libraries/sysinfo.lib.php';
  120. $sysinfo = getSysInfo();
  121. }
  122. if (!$cpuload) {
  123. $cpuload = $sysinfo->loadavg();
  124. }
  125. if (PHP_OS == 'Linux') {
  126. $ret[$chart_id][$node_id][$point_id]['idle'] = $cpuload['idle'];
  127. $ret[$chart_id][$node_id][$point_id]['busy'] = $cpuload['busy'];
  128. } else
  129. $ret[$chart_id][$node_id][$point_id]['value'] = $cpuload['loadavg'];
  130. break;
  131. case 'memory':
  132. if (!$sysinfo) {
  133. include_once 'libraries/sysinfo.lib.php';
  134. $sysinfo = getSysInfo();
  135. }
  136. if (!$memory) {
  137. $memory = $sysinfo->memory();
  138. }
  139. $ret[$chart_id][$node_id][$point_id]['value'] = $memory[$pName];
  140. break;
  141. } /* switch */
  142. } /* foreach */
  143. } /* foreach */
  144. } /* foreach */
  145. // Retrieve all required status variables
  146. if (count($statusVars)) {
  147. $statusVarValues = PMA_DBI_fetch_result(
  148. "SHOW GLOBAL STATUS
  149. WHERE Variable_name='" . implode("' OR Variable_name='", $statusVars) . "'", 0, 1
  150. );
  151. } else {
  152. $statusVarValues = array();
  153. }
  154. // Retrieve all required server variables
  155. if (count($serverVars)) {
  156. $serverVarValues = PMA_DBI_fetch_result(
  157. "SHOW GLOBAL VARIABLES
  158. WHERE Variable_name='" . implode("' OR Variable_name='", $serverVars) . "'", 0, 1
  159. );
  160. } else {
  161. $serverVarValues = array();
  162. }
  163. // ...and now assign them
  164. foreach ($ret as $chart_id => $chartNodes) {
  165. foreach ($chartNodes as $node_id => $nodeDataPoints) {
  166. foreach ($nodeDataPoints as $point_id => $dataPoint) {
  167. switch($dataPoint['type']) {
  168. case 'statusvar':
  169. $ret[$chart_id][$node_id][$point_id]['value'] = $statusVarValues[$dataPoint['name']];
  170. break;
  171. case 'servervar':
  172. $ret[$chart_id][$node_id][$point_id]['value'] = $serverVarValues[$dataPoint['name']];
  173. break;
  174. }
  175. }
  176. }
  177. }
  178. $ret['x'] = microtime(true) * 1000;
  179. exit(json_encode($ret));
  180. }
  181. }
  182. if (isset($_REQUEST['log_data'])) {
  183. if (PMA_MYSQL_INT_VERSION < 50106) {
  184. /* FIXME: why this? */
  185. exit('""');
  186. }
  187. $start = intval($_REQUEST['time_start']);
  188. $end = intval($_REQUEST['time_end']);
  189. if ($_REQUEST['type'] == 'slow') {
  190. $q = 'SELECT start_time, user_host, Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, '.
  191. 'SUM(rows_sent) AS rows_sent, SUM(rows_examined) AS rows_examined, db, sql_text, COUNT(sql_text) AS \'#\' '.
  192. 'FROM `mysql`.`slow_log` WHERE start_time > FROM_UNIXTIME(' . $start . ') '.
  193. 'AND start_time < FROM_UNIXTIME(' . $end . ') GROUP BY sql_text';
  194. $result = PMA_DBI_try_query($q);
  195. $return = array('rows' => array(), 'sum' => array());
  196. $type = '';
  197. while ($row = PMA_DBI_fetch_assoc($result)) {
  198. $type = strtolower(substr($row['sql_text'], 0, strpos($row['sql_text'], ' ')));
  199. switch($type) {
  200. case 'insert':
  201. case 'update':
  202. // Cut off big inserts and updates, but append byte count therefor
  203. if (strlen($row['sql_text']) > 220) {
  204. $row['sql_text'] = substr($row['sql_text'], 0, 200)
  205. . '... ['
  206. . implode(' ', PMA_formatByteDown(strlen($row['sql_text']), 2, 2))
  207. . ']';
  208. }
  209. break;
  210. default:
  211. break;
  212. }
  213. if (!isset($return['sum'][$type])) {
  214. $return['sum'][$type] = 0;
  215. }
  216. $return['sum'][$type] += $row['#'];
  217. $return['rows'][] = $row;
  218. }
  219. $return['sum']['TOTAL'] = array_sum($return['sum']);
  220. $return['numRows'] = count($return['rows']);
  221. PMA_DBI_free_result($result);
  222. exit(json_encode($return));
  223. }
  224. if ($_REQUEST['type'] == 'general') {
  225. $limitTypes = (isset($_REQUEST['limitTypes']) && $_REQUEST['limitTypes'])
  226. ? 'AND argument REGEXP \'^(INSERT|SELECT|UPDATE|DELETE)\' ' : '';
  227. $q = 'SELECT TIME(event_time) as event_time, user_host, thread_id, server_id, argument, count(argument) as \'#\' '.
  228. 'FROM `mysql`.`general_log` WHERE command_type=\'Query\' '.
  229. 'AND event_time > FROM_UNIXTIME(' . $start . ') AND event_time < FROM_UNIXTIME(' . $end . ') '.
  230. $limitTypes . 'GROUP by argument'; // HAVING count > 1';
  231. $result = PMA_DBI_try_query($q);
  232. $return = array('rows' => array(), 'sum' => array());
  233. $type = '';
  234. $insertTables = array();
  235. $insertTablesFirst = -1;
  236. $i = 0;
  237. $removeVars = isset($_REQUEST['removeVariables']) && $_REQUEST['removeVariables'];
  238. while ($row = PMA_DBI_fetch_assoc($result)) {
  239. preg_match('/^(\w+)\s/', $row['argument'], $match);
  240. $type = strtolower($match[1]);
  241. if (!isset($return['sum'][$type])) {
  242. $return['sum'][$type] = 0;
  243. }
  244. $return['sum'][$type] += $row['#'];
  245. switch($type) {
  246. case 'insert':
  247. // Group inserts if selected
  248. if ($removeVars && preg_match('/^INSERT INTO (`|\'|"|)([^\s\\1]+)\\1/i', $row['argument'], $matches)) {
  249. $insertTables[$matches[2]]++;
  250. if ($insertTables[$matches[2]] > 1) {
  251. $return['rows'][$insertTablesFirst]['#'] = $insertTables[$matches[2]];
  252. // Add a ... to the end of this query to indicate that there's been other queries
  253. if ($return['rows'][$insertTablesFirst]['argument'][strlen($return['rows'][$insertTablesFirst]['argument'])-1] != '.') {
  254. $return['rows'][$insertTablesFirst]['argument'] .= '<br/>...';
  255. }
  256. // Group this value, thus do not add to the result list
  257. continue 2;
  258. } else {
  259. $insertTablesFirst = $i;
  260. $insertTables[$matches[2]] += $row['#'] - 1;
  261. }
  262. }
  263. // No break here
  264. case 'update':
  265. // Cut off big inserts and updates, but append byte count therefor
  266. if (strlen($row['argument']) > 220) {
  267. $row['argument'] = substr($row['argument'], 0, 200)
  268. . '... ['
  269. . implode(' ', PMA_formatByteDown(strlen($row['argument'])), 2, 2)
  270. . ']';
  271. }
  272. break;
  273. default:
  274. break;
  275. }
  276. $return['rows'][] = $row;
  277. $i++;
  278. }
  279. $return['sum']['TOTAL'] = array_sum($return['sum']);
  280. $return['numRows'] = count($return['rows']);
  281. PMA_DBI_free_result($result);
  282. exit(json_encode($return));
  283. }
  284. }
  285. if (isset($_REQUEST['logging_vars'])) {
  286. if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
  287. $value = PMA_sqlAddslashes($_REQUEST['varValue']);
  288. if (!is_numeric($value)) {
  289. $value="'" . $value . "'";
  290. }
  291. if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])) {
  292. PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value);
  293. }
  294. }
  295. $loggingVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES WHERE Variable_name IN ("general_log","slow_query_log","long_query_time","log_output")', 0, 1);
  296. exit(json_encode($loggingVars));
  297. }
  298. if (isset($_REQUEST['query_analyzer'])) {
  299. $return = array();
  300. if (strlen($_REQUEST['database'])) {
  301. PMA_DBI_select_db($_REQUEST['database']);
  302. }
  303. if ($profiling = PMA_profilingSupported()) {
  304. PMA_DBI_query('SET PROFILING=1;');
  305. }
  306. // Do not cache query
  307. $query = preg_replace('/^(\s*SELECT)/i', '\\1 SQL_NO_CACHE', $_REQUEST['query']);
  308. $result = PMA_DBI_try_query($query);
  309. $return['affectedRows'] = $GLOBALS['cached_affected_rows'];
  310. $result = PMA_DBI_try_query('EXPLAIN ' . $query);
  311. while ($row = PMA_DBI_fetch_assoc($result)) {
  312. $return['explain'][] = $row;
  313. }
  314. // In case an error happened
  315. $return['error'] = PMA_DBI_getError();
  316. PMA_DBI_free_result($result);
  317. if ($profiling) {
  318. $return['profiling'] = array();
  319. $result = PMA_DBI_try_query('SELECT seq,state,duration FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID=1 ORDER BY seq');
  320. while ($row = PMA_DBI_fetch_assoc($result)) {
  321. $return['profiling'][]= $row;
  322. }
  323. PMA_DBI_free_result($result);
  324. }
  325. exit(json_encode($return));
  326. }
  327. if (isset($_REQUEST['advisor'])) {
  328. include 'libraries/Advisor.class.php';
  329. $advisor = new Advisor();
  330. exit(json_encode($advisor->run()));
  331. }
  332. }
  333. /**
  334. * Replication library
  335. */
  336. if (PMA_DRIZZLE) {
  337. $server_master_status = false;
  338. $server_slave_status = false;
  339. } else {
  340. include_once './libraries/replication.inc.php';
  341. include_once './libraries/replication_gui.lib.php';
  342. }
  343. /**
  344. * JS Includes
  345. */
  346. $GLOBALS['js_include'][] = 'server_status.js';
  347. $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.16.custom.js';
  348. $GLOBALS['js_include'][] = 'jquery/jquery.tablesorter.js';
  349. $GLOBALS['js_include'][] = 'jquery/jquery.cookie.js'; // For tab persistence
  350. // Charting
  351. $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
  352. /* Files required for chart exporting */
  353. $GLOBALS['js_include'][] = 'highcharts/exporting.js';
  354. /* < IE 9 doesn't support canvas natively */
  355. if (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 9) {
  356. $GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
  357. }
  358. $GLOBALS['js_include'][] = 'canvg/canvg.js';
  359. // for profiling chart
  360. $GLOBALS['js_include'][] = 'jqplot/jquery.jqplot.js';
  361. $GLOBALS['js_include'][] = 'jqplot/plugins/jqplot.pieRenderer.js';
  362. /**
  363. * flush status variables if requested
  364. */
  365. if (isset($_REQUEST['flush'])) {
  366. $_flush_commands = array(
  367. 'STATUS',
  368. 'TABLES',
  369. 'QUERY CACHE',
  370. );
  371. if (in_array($_REQUEST['flush'], $_flush_commands)) {
  372. PMA_DBI_query('FLUSH ' . $_REQUEST['flush'] . ';');
  373. }
  374. unset($_flush_commands);
  375. }
  376. /**
  377. * Kills a selected process
  378. */
  379. if (!empty($_REQUEST['kill'])) {
  380. if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
  381. $message = PMA_Message::success(__('Thread %s was successfully killed.'));
  382. } else {
  383. $message = PMA_Message::error(__('phpMyAdmin was unable to kill thread %s. It probably has already been closed.'));
  384. }
  385. $message->addParam($_REQUEST['kill']);
  386. //$message->display();
  387. }
  388. /**
  389. * get status from server
  390. */
  391. $server_status = PMA_DBI_fetch_result('SHOW GLOBAL STATUS', 0, 1);
  392. if (PMA_DRIZZLE) {
  393. // Drizzle doesn't put query statistics into variables, add it
  394. $sql = "SELECT concat('Com_', variable_name), variable_value
  395. FROM data_dictionary.GLOBAL_STATEMENTS";
  396. $statements = PMA_DBI_fetch_result($sql, 0, 1);
  397. $server_status = array_merge($server_status, $statements);
  398. }
  399. /**
  400. * for some calculations we require also some server settings
  401. */
  402. $server_variables = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES', 0, 1);
  403. /**
  404. * cleanup of some deprecated values
  405. */
  406. cleanDeprecated($server_status);
  407. /**
  408. * calculate some values
  409. */
  410. // Key_buffer_fraction
  411. if (isset($server_status['Key_blocks_unused'])
  412. && isset($server_variables['key_cache_block_size'])
  413. && isset($server_variables['key_buffer_size'])
  414. ) {
  415. $server_status['Key_buffer_fraction_%']
  416. = 100
  417. - $server_status['Key_blocks_unused']
  418. * $server_variables['key_cache_block_size']
  419. / $server_variables['key_buffer_size']
  420. * 100;
  421. } elseif (isset($server_status['Key_blocks_used'])
  422. && isset($server_variables['key_buffer_size'])) {
  423. $server_status['Key_buffer_fraction_%']
  424. = $server_status['Key_blocks_used']
  425. * 1024
  426. / $server_variables['key_buffer_size'];
  427. }
  428. // Ratio for key read/write
  429. if (isset($server_status['Key_writes'])
  430. && isset($server_status['Key_write_requests'])
  431. && $server_status['Key_write_requests'] > 0
  432. ) {
  433. $server_status['Key_write_ratio_%'] = 100 * $server_status['Key_writes'] / $server_status['Key_write_requests'];
  434. }
  435. if (isset($server_status['Key_reads'])
  436. && isset($server_status['Key_read_requests'])
  437. && $server_status['Key_read_requests'] > 0
  438. ) {
  439. $server_status['Key_read_ratio_%'] = 100 * $server_status['Key_reads'] / $server_status['Key_read_requests'];
  440. }
  441. // Threads_cache_hitrate
  442. if (isset($server_status['Threads_created'])
  443. && isset($server_status['Connections'])
  444. && $server_status['Connections'] > 0
  445. ) {
  446. $server_status['Threads_cache_hitrate_%']
  447. = 100 - $server_status['Threads_created'] / $server_status['Connections'] * 100;
  448. }
  449. /**
  450. * split variables in sections
  451. */
  452. $allocations = array(
  453. // variable name => section
  454. // variable names match when they begin with the given string
  455. 'Com_' => 'com',
  456. 'Innodb_' => 'innodb',
  457. 'Ndb_' => 'ndb',
  458. 'Handler_' => 'handler',
  459. 'Qcache_' => 'qcache',
  460. 'Threads_' => 'threads',
  461. 'Slow_launch_threads' => 'threads',
  462. 'Binlog_cache_' => 'binlog_cache',
  463. 'Created_tmp_' => 'created_tmp',
  464. 'Key_' => 'key',
  465. 'Delayed_' => 'delayed',
  466. 'Not_flushed_delayed_rows' => 'delayed',
  467. 'Flush_commands' => 'query',
  468. 'Last_query_cost' => 'query',
  469. 'Slow_queries' => 'query',
  470. 'Queries' => 'query',
  471. 'Prepared_stmt_count' => 'query',
  472. 'Select_' => 'select',
  473. 'Sort_' => 'sort',
  474. 'Open_tables' => 'table',
  475. 'Opened_tables' => 'table',
  476. 'Open_table_definitions' => 'table',
  477. 'Opened_table_definitions' => 'table',
  478. 'Table_locks_' => 'table',
  479. 'Rpl_status' => 'repl',
  480. 'Slave_' => 'repl',
  481. 'Tc_' => 'tc',
  482. 'Ssl_' => 'ssl',
  483. 'Open_files' => 'files',
  484. 'Open_streams' => 'files',
  485. 'Opened_files' => 'files',
  486. );
  487. $sections = array(
  488. // section => section name (description)
  489. 'com' => 'Com',
  490. 'query' => __('SQL query'),
  491. 'innodb' => 'InnoDB',
  492. 'ndb' => 'NDB',
  493. 'handler' => __('Handler'),
  494. 'qcache' => __('Query cache'),
  495. 'threads' => __('Threads'),
  496. 'binlog_cache' => __('Binary log'),
  497. 'created_tmp' => __('Temporary data'),
  498. 'delayed' => __('Delayed inserts'),
  499. 'key' => __('Key cache'),
  500. 'select' => __('Joins'),
  501. 'repl' => __('Replication'),
  502. 'sort' => __('Sorting'),
  503. 'table' => __('Tables'),
  504. 'tc' => __('Transaction coordinator'),
  505. 'files' => __('Files'),
  506. 'ssl' => 'SSL',
  507. 'other' => __('Other')
  508. );
  509. /**
  510. * define some needfull links/commands
  511. */
  512. // variable or section name => (name => url)
  513. $links = array();
  514. $links['table'][__('Flush (close) all tables')]
  515. = $PMA_PHP_SELF . '?flush=TABLES&amp;' . PMA_generate_common_url();
  516. $links['table'][__('Show open tables')]
  517. = 'sql.php?sql_query=' . urlencode('SHOW OPEN TABLES') .
  518. '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
  519. if ($server_master_status) {
  520. $links['repl'][__('Show slave hosts')]
  521. = 'sql.php?sql_query=' . urlencode('SHOW SLAVE HOSTS') .
  522. '&amp;goto=server_status.php&amp;' . PMA_generate_common_url();
  523. $links['repl'][__('Show master status')] = '#replication_master';
  524. }
  525. if ($server_slave_status) {
  526. $links['repl'][__('Show slave status')] = '#replication_slave';
  527. }
  528. $links['repl']['doc'] = 'replication';
  529. $links['qcache'][__('Flush query cache')]
  530. = $PMA_PHP_SELF . '?flush=' . urlencode('QUERY CACHE') . '&amp;' .
  531. PMA_generate_common_url();
  532. $links['qcache']['doc'] = 'query_cache';
  533. //$links['threads'][__('Show processes')]
  534. // = 'server_processlist.php?' . PMA_generate_common_url();
  535. $links['threads']['doc'] = 'mysql_threads';
  536. $links['key']['doc'] = 'myisam_key_cache';
  537. $links['binlog_cache']['doc'] = 'binary_log';
  538. $links['Slow_queries']['doc'] = 'slow_query_log';
  539. $links['innodb'][__('Variables')]
  540. = 'server_engines.php?engine=InnoDB&amp;' . PMA_generate_common_url();
  541. $links['innodb'][__('InnoDB Status')]
  542. = 'server_engines.php?engine=InnoDB&amp;page=Status&amp;' .
  543. PMA_generate_common_url();
  544. $links['innodb']['doc'] = 'innodb';
  545. // Variable to contain all com_ variables (query statistics)
  546. $used_queries = array();
  547. // Variable to map variable names to their respective section name
  548. // (used for js category filtering)
  549. $allocationMap = array();
  550. // Variable to mark used sections
  551. $categoryUsed = array();
  552. // sort vars into arrays
  553. foreach ($server_status as $name => $value) {
  554. $section_found = false;
  555. foreach ($allocations as $filter => $section) {
  556. if (strpos($name, $filter) !== false) {
  557. $allocationMap[$name] = $section;
  558. $categoryUsed[$section] = true;
  559. $section_found = true;
  560. if ($section == 'com' && $value > 0) {
  561. $used_queries[$name] = $value;
  562. }
  563. break; // Only exits inner loop
  564. }
  565. }
  566. if (!$section_found) {
  567. $allocationMap[$name] = 'other';
  568. $categoryUsed['other'] = true;
  569. }
  570. }
  571. if (PMA_DRIZZLE) {
  572. $used_queries = PMA_DBI_fetch_result(
  573. 'SELECT * FROM data_dictionary.global_statements',
  574. 0,
  575. 1
  576. );
  577. unset($used_queries['admin_commands']);
  578. } else {
  579. // admin commands are not queries (e.g. they include COM_PING,
  580. // which is excluded from $server_status['Questions'])
  581. unset($used_queries['Com_admin_commands']);
  582. }
  583. /* Ajax request refresh */
  584. if (isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) {
  585. switch($_REQUEST['show']) {
  586. case 'query_statistics':
  587. printQueryStatistics();
  588. exit();
  589. case 'server_traffic':
  590. printServerTraffic();
  591. exit();
  592. case 'variables_table':
  593. // Prints the variables table
  594. printVariablesTable();
  595. exit();
  596. default:
  597. break;
  598. }
  599. }
  600. $server_db_isLocal = strtolower($cfg['Server']['host']) == 'localhost'
  601. || $cfg['Server']['host'] == '127.0.0.1'
  602. || $cfg['Server']['host'] == '::1';
  603. PMA_AddJSVar(
  604. 'pma_token',
  605. $_SESSION[' PMA_token ']
  606. );
  607. PMA_AddJSVar(
  608. 'url_query',
  609. str_replace('&amp;', '&', PMA_generate_common_url($db))
  610. );
  611. PMA_AddJSVar(
  612. 'server_time_diff',
  613. 'new Date().getTime() - ' . (microtime(true) * 1000),
  614. false
  615. );
  616. PMA_AddJSVar(
  617. 'server_os',
  618. PHP_OS
  619. );
  620. PMA_AddJSVar(
  621. 'is_superuser',
  622. PMA_isSuperuser()
  623. );
  624. PMA_AddJSVar(
  625. 'server_db_isLocal',
  626. $server_db_isLocal
  627. );
  628. PMA_AddJSVar(
  629. 'profiling_docu',
  630. PMA_showMySQLDocu('general-thread-states', 'general-thread-states')
  631. );
  632. PMA_AddJSVar(
  633. 'explain_docu',
  634. PMA_showMySQLDocu('explain-output', 'explain-output')
  635. );
  636. /**
  637. * start output
  638. */
  639. /**
  640. * Does the common work
  641. */
  642. require './libraries/server_common.inc.php';
  643. /**
  644. * Displays the links
  645. */
  646. require './libraries/server_links.inc.php';
  647. ?>
  648. <div id="serverstatus">
  649. <h2><?php
  650. /**
  651. * Displays the sub-page heading
  652. */
  653. if ($GLOBALS['cfg']['MainPageIconic']) {
  654. echo PMA_getImage('s_status.png');
  655. }
  656. echo __('Runtime Information');
  657. ?></h2>
  658. <div id="serverStatusTabs">
  659. <ul>
  660. <li><a href="#statustabs_traffic"><?php echo __('Server'); ?></a></li>
  661. <li><a href="#statustabs_queries"><?php echo __('Query statistics'); ?></a></li>
  662. <li><a href="#statustabs_allvars"><?php echo __('All status variables'); ?></a></li>
  663. <li class="jsfeature"><a href="#statustabs_charting"><?php echo __('Monitor'); ?></a></li>
  664. <li class="jsfeature"><a href="#statustabs_advisor"><?php echo __('Advisor'); ?></a></li>
  665. </ul>
  666. <div id="statustabs_traffic" class="clearfloat">
  667. <div class="buttonlinks jsfeature">
  668. <a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=server_traffic&amp;' . PMA_generate_common_url(); ?>" >
  669. <img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
  670. <?php echo __('Refresh'); ?>
  671. </a>
  672. <span class="refreshList" style="display:none;">
  673. <label for="id_trafficChartRefresh"><?php echo __('Refresh rate: '); ?></label>
  674. <?php refreshList('trafficChartRefresh'); ?>
  675. </span>
  676. <a class="tabChart livetrafficLink" href="#">
  677. <?php echo __('Live traffic chart'); ?>
  678. </a>
  679. <a class="tabChart liveconnectionsLink" href="#">
  680. <?php echo __('Live conn./process chart'); ?>
  681. </a>
  682. </div>
  683. <div class="tabInnerContent">
  684. <?php printServerTraffic(); ?>
  685. </div>
  686. </div>
  687. <div id="statustabs_queries" class="clearfloat">
  688. <div class="buttonlinks jsfeature">
  689. <a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=query_statistics&amp;' . PMA_generate_common_url(); ?>" >
  690. <img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
  691. <?php echo __('Refresh'); ?>
  692. </a>
  693. <span class="refreshList" style="display:none;">
  694. <label for="id_queryChartRefresh"><?php echo __('Refresh rate: '); ?></label>
  695. <?php refreshList('queryChartRefresh'); ?>
  696. </span>
  697. <a class="tabChart livequeriesLink" href="#">
  698. <?php echo __('Live query chart'); ?>
  699. </a>
  700. </div>
  701. <div class="tabInnerContent">
  702. <?php printQueryStatistics(); ?>
  703. </div>
  704. </div>
  705. <div id="statustabs_allvars" class="clearfloat">
  706. <fieldset id="tableFilter" class="jsfeature">
  707. <div class="buttonlinks">
  708. <a class="tabRefresh" href="<?php echo $PMA_PHP_SELF . '?show=variables_table&amp;' . PMA_generate_common_url(); ?>" >
  709. <img src="<?php echo $GLOBALS['pmaThemeImage'];?>ajax_clock_small.gif" alt="ajax clock" style="display: none;" />
  710. <?php echo __('Refresh'); ?>
  711. </a>
  712. </div>
  713. <legend><?php echo __('Filters'); ?></legend>
  714. <div class="formelement">
  715. <label for="filterText"><?php echo __('Containing the word:'); ?></label>
  716. <input name="filterText" type="text" id="filterText" style="vertical-align: baseline;" />
  717. </div>
  718. <div class="formelement">
  719. <input type="checkbox" name="filterAlert" id="filterAlert" />
  720. <label for="filterAlert"><?php echo __('Show only alert values'); ?></label>
  721. </div>
  722. <div class="formelement">
  723. <select id="filterCategory" name="filterCategory">
  724. <option value=''><?php echo __('Filter by category...'); ?></option>
  725. <?php
  726. foreach ($sections as $section_id => $section_name) {
  727. if (isset($categoryUsed[$section_id])) {
  728. ?>
  729. <option value='<?php echo $section_id; ?>'><?php echo $section_name; ?></option>
  730. <?php
  731. }
  732. }
  733. ?>
  734. </select>
  735. </div>
  736. <div class="formelement">
  737. <input type="checkbox" name="dontFormat" id="dontFormat" />
  738. <label for="dontFormat"><?php echo __('Show unformatted values'); ?></label>
  739. </div>
  740. </fieldset>
  741. <div id="linkSuggestions" class="defaultLinks" style="display:none">
  742. <p class="notice"><?php echo __('Related links:'); ?>
  743. <?php
  744. foreach ($links as $section_name => $section_links) {
  745. echo '<span class="status_' . $section_name . '"> ';
  746. $i=0;
  747. foreach ($section_links as $link_name => $link_url) {
  748. if ($i > 0) {
  749. echo ', ';
  750. }
  751. if ('doc' == $link_name) {
  752. echo PMA_showMySQLDocu($link_url, $link_url);
  753. } else {
  754. echo '<a href="' . $link_url . '">' . $link_name . '</a>';
  755. }
  756. $i++;
  757. }
  758. echo '</span>';
  759. }
  760. unset($link_url, $link_name, $i);
  761. ?>
  762. </p>
  763. </div>
  764. <div class="tabInnerContent">
  765. <?php printVariablesTable(); ?>
  766. </div>
  767. </div>
  768. <div id="statustabs_charting" class="jsfeature">
  769. <?php printMonitor(); ?>
  770. </div>
  771. <div id="statustabs_advisor" class="jsfeature">
  772. <div class="tabLinks">
  773. <?php echo PMA_getImage('play.png'); ?> <a href="#startAnalyzer"><?php echo __('Run analyzer'); ?></a>
  774. <?php echo PMA_getImage('b_help.png'); ?> <a href="#openAdvisorInstructions"><?php echo __('Instructions'); ?></a>
  775. </div>
  776. <div class="tabInnerContent clearfloat">
  777. </div>
  778. <div id="advisorInstructionsDialog" style="display:none;">
  779. <?php
  780. echo '<p>';
  781. echo __('The Advisor system can provide recommendations on server variables by analyzing the server status variables.');
  782. echo '</p> <p>';
  783. echo __('Do note however that this system provides recommendations based on simple calculations and by rule of thumb which may not necessarily apply to your system.');
  784. echo '</p> <p>';
  785. echo __('Prior to changing any of the configuration, be sure to know what you are changing (by reading the documentation) and how to undo the change. Wrong tuning can have a very negative effect on performance.');
  786. echo '</p> <p>';
  787. echo __('The best way to tune your system would be to change only one setting at a time, observe or benchmark your database, and undo the change if there was no clearly measurable improvement.');
  788. echo '</p>';
  789. ?>
  790. </div>
  791. </div>
  792. </div>
  793. </div>
  794. <?php
  795. function printQueryStatistics()
  796. {
  797. global $server_status, $used_queries, $url_query, $PMA_PHP_SELF;
  798. $hour_factor = 3600 / $server_status['Uptime'];
  799. $total_queries = array_sum($used_queries);
  800. ?>
  801. <h3 id="serverstatusqueries">
  802. <?php
  803. /* l10n: Questions is the name of a MySQL Status variable */
  804. echo sprintf(__('Questions since startup: %s'), PMA_formatNumber($total_queries, 0)) . ' ';
  805. echo PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions');
  806. ?>
  807. <br />
  808. <span>
  809. <?php
  810. echo '&oslash; ' . __('per hour') . ': ';
  811. echo PMA_formatNumber($total_queries * $hour_factor, 0);
  812. echo '<br />';
  813. echo '&oslash; ' . __('per minute') . ': ';
  814. echo PMA_formatNumber($total_queries * 60 / $server_status['Uptime'], 0);
  815. echo '<br />';
  816. if ($total_queries / $server_status['Uptime'] >= 1) {
  817. echo '&oslash; ' . __('per second') . ': ';
  818. echo PMA_formatNumber($total_queries / $server_status['Uptime'], 0);
  819. }
  820. ?>
  821. </span>
  822. </h3>
  823. <?php
  824. // reverse sort by value to show most used statements first
  825. arsort($used_queries);
  826. $odd_row = true;
  827. $count_displayed_rows = 0;
  828. $perc_factor = 100 / $total_queries; //(- $server_status['Connections']);
  829. ?>
  830. <table id="serverstatusqueriesdetails" class="data sortable noclick">
  831. <col class="namecol" />
  832. <col class="valuecol" span="3" />
  833. <thead>
  834. <tr><th><?php echo __('Statements'); ?></th>
  835. <th><?php
  836. /* l10n: # = Amount of queries */
  837. echo __('#');
  838. ?>
  839. </th>
  840. <th>&oslash; <?php echo __('per hour'); ?></th>
  841. <th>%</th>
  842. </tr>
  843. </thead>
  844. <tbody>
  845. <?php
  846. $chart_json = array();
  847. $query_sum = array_sum($used_queries);
  848. $other_sum = 0;
  849. foreach ($used_queries as $name => $value) {
  850. $odd_row = !$odd_row;
  851. // For the percentage column, use Questions - Connections, because
  852. // the number of connections is not an item of the Query types
  853. // but is included in Questions. Then the total of the percentages is 100.
  854. $name = str_replace(array('Com_', '_'), array('', ' '), $name);
  855. // Group together values that make out less than 2% into "Other", but only if we have more than 6 fractions already
  856. if ($value < $query_sum * 0.02 && count($chart_json)>6) {
  857. $other_sum += $value;
  858. } else {
  859. $chart_json[$name] = $value;
  860. }
  861. ?>
  862. <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
  863. <th class="name"><?php echo htmlspecialchars($name); ?></th>
  864. <td class="value"><?php echo htmlspecialchars(PMA_formatNumber($value, 5, 0, true)); ?></td>
  865. <td class="value"><?php echo
  866. htmlspecialchars(PMA_formatNumber($value * $hour_factor, 4, 1, true)); ?></td>
  867. <td class="value"><?php echo
  868. htmlspecialchars(PMA_formatNumber($value * $perc_factor, 0, 2)); ?>%</td>
  869. </tr>
  870. <?php
  871. }
  872. ?>
  873. </tbody>
  874. </table>
  875. <div id="serverstatusquerieschart">
  876. <span style="display:none;">
  877. <?php
  878. if ($other_sum > 0) {
  879. $chart_json[__('Other')] = $other_sum;
  880. }
  881. echo json_encode($chart_json);
  882. ?>
  883. </span>
  884. </div>
  885. <?php
  886. }
  887. function printServerTraffic()
  888. {
  889. global $server_status, $PMA_PHP_SELF;
  890. global $server_master_status, $server_slave_status, $replication_types;
  891. $hour_factor = 3600 / $server_status['Uptime'];
  892. /**
  893. * starttime calculation
  894. */
  895. $start_time = PMA_DBI_fetch_value(
  896. 'SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime']
  897. );
  898. ?>
  899. <h3><?php
  900. echo sprintf(
  901. __('Network traffic since startup: %s'),
  902. implode(' ', PMA_formatByteDown($server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1))
  903. );
  904. ?>
  905. </h3>
  906. <p>
  907. <?php
  908. echo sprintf(
  909. __('This MySQL server has been running for %1$s. It started up on %2$s.'),
  910. PMA_timespanFormat($server_status['Uptime']),
  911. PMA_localisedDate($start_time)
  912. ) . "\n";
  913. ?>
  914. </p>
  915. <?php
  916. if ($server_master_status || $server_slave_status) {
  917. echo '<p class="notice">';
  918. if ($server_master_status && $server_slave_status) {
  919. echo __('This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.');
  920. } elseif ($server_master_status) {
  921. echo __('This MySQL server works as <b>master</b> in <b>replication</b> process.');
  922. } elseif ($server_slave_status) {
  923. echo __('This MySQL server works as <b>slave</b> in <b>replication</b> process.');
  924. }
  925. echo ' ';
  926. echo __('For further information about replication status on the server, please visit the <a href="#replication">replication section</a>.');
  927. echo '</p>';
  928. }
  929. /* if the server works as master or slave in replication process, display useful information */
  930. if ($server_master_status || $server_slave_status) {
  931. ?>
  932. <hr class="clearfloat" />
  933. <h3><a name="replication"></a><?php echo __('Replication status'); ?></h3>
  934. <?php
  935. foreach ($replication_types as $type) {
  936. if (${"server_{$type}_status"}) {
  937. PMA_replication_print_status_table($type);
  938. }
  939. }
  940. unset($types);
  941. }
  942. ?>
  943. <table id="serverstatustraffic" class="data noclick">
  944. <thead>
  945. <tr>
  946. <th colspan="2"><?php echo __('Traffic') . '&nbsp;' . PMA_showHint(__('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.')); ?></th>
  947. <th>&oslash; <?php echo __('per hour'); ?></th>
  948. </tr>
  949. </thead>
  950. <tbody>
  951. <tr class="odd">
  952. <th class="name"><?php echo __('Received'); ?></th>
  953. <td class="value"><?php echo
  954. implode(' ',
  955. PMA_formatByteDown($server_status['Bytes_received'], 3, 1)); ?></td>
  956. <td class="value"><?php echo
  957. implode(' ',
  958. PMA_formatByteDown(
  959. $server_status['Bytes_received'] * $hour_factor, 3, 1)); ?></td>
  960. </tr>
  961. <tr class="even">
  962. <th class="name"><?php echo __('Sent'); ?></th>
  963. <td class="value"><?php echo
  964. implode(' ',
  965. PMA_formatByteDown($server_status['Bytes_sent'], 3, 1)); ?></td>
  966. <td class="value"><?php echo
  967. implode(' ',
  968. PMA_formatByteDown(
  969. $server_status['Bytes_sent'] * $hour_factor, 3, 1)); ?></td>
  970. </tr>
  971. <tr class="odd">
  972. <th class="name"><?php echo __('Total'); ?></th>
  973. <td class="value"><?php echo
  974. implode(' ',
  975. PMA_formatByteDown(
  976. $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1)
  977. ); ?></td>
  978. <td class="value"><?php echo
  979. implode(' ',
  980. PMA_formatByteDown(
  981. ($server_status['Bytes_received'] + $server_status['Bytes_sent'])
  982. * $hour_factor, 3, 1)
  983. ); ?></td>
  984. </tr>
  985. </tbody>
  986. </table>
  987. <table id="serverstatusconnections" class="data noclick">
  988. <thead>
  989. <tr>
  990. <th colspan="2"><?php echo __('Connections'); ?></th>
  991. <th>&oslash; <?php echo __('per hour'); ?></th>
  992. <th>%</th>
  993. </tr>
  994. </thead>
  995. <tbody>
  996. <tr class="odd">
  997. <th class="name"><?php echo __('max. concurrent connections'); ?></th>
  998. <td class="value"><?php echo
  999. PMA_formatNumber($server_status['Max_used_connections'], 0); ?> </td>
  1000. <td class="value">--- </td>
  1001. <td class="value">--- </td>
  1002. </tr>
  1003. <tr class="even">
  1004. <th class="name"><?php echo __('Failed attempts'); ?></th>
  1005. <td class="value"><?php echo
  1006. PMA_formatNumber($server_status['Aborted_connects'], 4, 1, true); ?></td>
  1007. <td class="value"><?php echo
  1008. PMA_formatNumber($server_status['Aborted_connects'] * $hour_factor,
  1009. 4, 2, true); ?></td>
  1010. <td class="value"><?php echo
  1011. $server_status['Connections'] > 0
  1012. ? PMA_formatNumber(
  1013. $server_status['Aborted_connects'] * 100 / $server_status['Connections'],
  1014. 0, 2, true) . '%'
  1015. : '--- '; ?></td>
  1016. </tr>
  1017. <tr class="odd">
  1018. <th class="name"><?php echo __('Aborted'); ?></th>
  1019. <td class="value"><?php echo
  1020. PMA_formatNumber($server_status['Aborted_clients'], 4, 1, true); ?></td>
  1021. <td class="value"><?php echo
  1022. PMA_formatNumber($server_status['Aborted_clients'] * $hour_factor,
  1023. 4, 2, true); ?></td>
  1024. <td class="value"><?php echo
  1025. $server_status['Connections'] > 0
  1026. ? PMA_formatNumber(
  1027. $server_status['Aborted_clients'] * 100 / $server_status['Connections'],
  1028. 0, 2, true) . '%'
  1029. : '--- '; ?></td>
  1030. </tr>
  1031. <tr class="even">
  1032. <th class="name"><?php echo __('Total'); ?></th>
  1033. <td class="value"><?php echo
  1034. PMA_formatNumber($server_status['Connections'], 4, 0); ?></td>
  1035. <td class="value"><?php echo
  1036. PMA_formatNumber($server_status['Connections'] * $hour_factor,
  1037. 4, 2); ?></td>
  1038. <td class="value"><?php echo
  1039. PMA_formatNumber(100, 0, 2); ?>%</td>
  1040. </tr>
  1041. </tbody>
  1042. </table>
  1043. <?php
  1044. $url_params = array();
  1045. $show_full_sql = !empty($_REQUEST['full']);
  1046. if ($show_full_sql) {
  1047. $url_params['full'] = 1;
  1048. $full_text_link = 'server_status.php' . PMA_generate_common_url(array(), 'html', '?');
  1049. } else {
  1050. $full_text_link = 'server_status.php' . PMA_generate_common_url(array('full' => 1));
  1051. }
  1052. if (PMA_DRIZZLE) {
  1053. $sql_query = "SELECT
  1054. p.id AS Id,
  1055. p.username AS User,
  1056. p.host AS Host,
  1057. p.db AS db,
  1058. p.command AS Command,
  1059. p.time AS Time,
  1060. p.state AS State,
  1061. " . ($show_full_sql ? 's.query' : 'left(p.info, ' . (int)$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] . ')') . " AS Info
  1062. FROM data_dictionary.PROCESSLIST p
  1063. " . ($show_full_sql ? 'LEFT JOIN data_dictionary.SESSIONS s ON s.session_id = p.id' : '');
  1064. } else {
  1065. $sql_query = $show_full_sql
  1066. ? 'SHOW FULL PROCESSLIST'
  1067. : 'SHOW PROCESSLIST';
  1068. }
  1069. $result = PMA_DBI_query($sql_query);
  1070. /**
  1071. * Displays the page
  1072. */
  1073. ?>
  1074. <table id="tableprocesslist" class="data clearfloat noclick">
  1075. <thead>
  1076. <tr>
  1077. <th><?php echo __('Processes'); ?></th>
  1078. <th><?php echo __('ID'); ?></th>
  1079. <th><?php echo __('User'); ?></th>
  1080. <th><?php echo __('Host'); ?></th>
  1081. <th><?php echo __('Database'); ?></th>
  1082. <th><?php echo __('Command'); ?></th>
  1083. <th><?php echo __('Time'); ?></th>
  1084. <th><?php echo __('Status'); ?></th>
  1085. <th><?php
  1086. echo __('SQL query');
  1087. if (! PMA_DRIZZLE) {
  1088. ?>
  1089. <a href="<?php echo $full_text_link; ?>"
  1090. title="<?php echo $show_full_sql ? __('Truncate Shown Queries') : __('Show Full Queries'); ?>">
  1091. <img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . ($show_full_sql ? 'partial' : 'full'); ?>text.png"
  1092. alt="<?php echo $show_full_sql ? __('Truncate Shown Queries') : __('Show Full Queries'); ?>" />
  1093. </a>
  1094. <?php } ?>
  1095. </th>
  1096. </tr>
  1097. </thead>
  1098. <tbody>
  1099. <?php
  1100. $odd_row = true;
  1101. while ($process = PMA_DBI_fetch_assoc($result)) {
  1102. $url_params['kill'] = $process['Id'];
  1103. $kill_process = 'server_status.php' . PMA_generate_common_url($url_params);
  1104. ?>
  1105. <tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
  1106. <td><a href="<?php echo $kill_process ; ?>"><?php echo __('Kill'); ?></a></td>
  1107. <td class="value"><?php echo $process['Id']; ?></td>
  1108. <td><?php echo $process['User']; ?></td>
  1109. <td><?php echo $process['Host']; ?></td>
  1110. <td><?php echo ((! isset($process['db']) || ! strlen($process['db'])) ? '<i>' . __('None') . '</i>' : $process['db']); ?></td>
  1111. <td><?php echo $process['Command']; ?></td>
  1112. <td class="value"><?php echo $process['Time']; ?></td>
  1113. <td><?php echo (empty($process['State']) ? '---' : $process['State']); ?></td>
  1114. <td>
  1115. <?php
  1116. if (empty($process['Info'])) {
  1117. echo '---';
  1118. } else {
  1119. if (!$show_full_sql && strlen($process['Info']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
  1120. echo htmlspecialchars(substr($process['Info'], 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'])) . '[...]';
  1121. } else {
  1122. echo PMA_SQP_formatHtml(PMA_SQP_parse($process['Info']));
  1123. }
  1124. }
  1125. ?>
  1126. </td>
  1127. </tr>
  1128. <?php
  1129. $odd_row = ! $odd_row;
  1130. }
  1131. ?>
  1132. </tbody>
  1133. </table>
  1134. <?php
  1135. }
  1136. function printVariablesTable()
  1137. {
  1138. global $server_status, $server_variables, $allocationMap, $links;
  1139. /**
  1140. * Messages are built using the message name
  1141. */
  1142. $strShowStatus = array(
  1143. 'Aborted_clients' => __('The number of connections that were aborted because the client died without closing the connection properly.'),
  1144. 'Aborted_connects' => __('The number of failed attempts to connect to the MySQL server.'),
  1145. 'Binlog_cache_disk_use' => __('The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction.'),
  1146. 'Binlog_cache_use' => __('The number of transactions that used the temporary binary log cache.'),
  1147. 'Connections' => __('The number of connection attempts (successful or not) to the MySQL server.'),
  1148. 'Created_tmp_disk_tables' => __('The number of temporary tables on disk created automatically by the server while executing statements. If Created_tmp_disk_tables is big, you may want to increase the tmp_table_size value to cause temporary tables to be memory-based instead of disk-based.'),
  1149. 'Created_tmp_files' => __('How many temporary files mysqld has created.'),
  1150. 'Created_tmp_tables' => __('The number of in-memory temporary tables created automatically by the server while executing statements.'),
  1151. 'Delayed_errors' => __('The number of rows written with INSERT DELAYED for which some error occurred (probably duplicate key).'),
  1152. 'Delayed_insert_threads' => __('The number of INSERT DELAYED handler threads in use. Every different table on which one uses INSERT DELAYED gets its own thread.'),
  1153. 'Delayed_writes' => __('The number of INSERT DELAYED rows written.'),
  1154. 'Flush_commands' => __('The number of executed FLUSH statements.'),
  1155. 'Handler_commit' => __('The number of internal COMMIT statements.'),
  1156. 'Handler_delete' => __('The number of times a row was deleted from a table.'),
  1157. 'Handler_discover' => __('The MySQL server can ask the NDB Cluster storage engine if it knows about a table with a given name. This is called discovery. Handler_discover indicates the number of time tables have been discovered.'),
  1158. 'Handler_read_first' => __('The number of times the first entry was read from an index. If this is high, it suggests that the server is doing a lot of full index scans; for example, SELECT col1 FROM foo, assuming that col1 is indexed.'),
  1159. 'Handler_read_key' => __('The number of requests to read a row based on a key. If this is high, it is a good indication that your queries and tables are properly indexed.'),
  1160. 'Handler_read_next' => __('The number of requests to read the next row in key order. This is incremented if you are querying an index column with a range constraint or if you are doing an index scan.'),
  1161. 'Handler_read_prev' => __('The number of requests to read the previous row in key order. T…

Large files files are truncated, but you can click here to view the full file