/admin/phpMyAdmin_old/libraries/engines/innodb.lib.php

https://bitbucket.org/steve_delbar/iepsm-projet-de-d-veloppement-internet-2013 · PHP · 193 lines · 182 code · 6 blank · 5 comment · 7 complexity · b598a929e9946a78df2eed393f419d38 MD5 · raw file

  1. <?php
  2. /* $Id: innodb.lib.php,v 2.5 2005/03/26 23:34:26 rabus Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4. class PMA_StorageEngine_innodb extends PMA_StorageEngine {
  5. function getVariables() {
  6. return array(
  7. 'innodb_data_home_dir' => array(
  8. 'title' => $GLOBALS['strInnoDBDataHomeDir'],
  9. 'desc' => $GLOBALS['strInnoDBDataHomeDirDesc']
  10. ),
  11. 'innodb_data_file_path' => array(
  12. 'title' => $GLOBALS['strInnoDBDataFilePath']
  13. ),
  14. 'innodb_autoextend_increment' => array(
  15. 'title' => $GLOBALS['strInnoDBAutoextendIncrement'],
  16. 'desc' => $GLOBALS['strInnoDBAutoextendIncrementDesc'],
  17. 'type' => PMA_ENGINE_DETAILS_TYPE_NUMERIC
  18. ),
  19. 'innodb_buffer_pool_size' => array(
  20. 'title' => $GLOBALS['strInnoDBBufferPoolSize'],
  21. 'desc' => $GLOBALS['strInnoDBBufferPoolSizeDesc'],
  22. 'type' => PMA_ENGINE_DETAILS_TYPE_SIZE
  23. )
  24. );
  25. }
  26. function getVariablesLikePattern () {
  27. return 'innodb\\_%';
  28. }
  29. function getInfoPages () {
  30. if ($this->support < PMA_ENGINE_SUPPORT_YES) {
  31. return array();
  32. }
  33. $pages = array();
  34. if (PMA_MYSQL_INT_VERSION >= 50002) {
  35. $pages['bufferpool'] = $GLOBALS['strBufferPool'];
  36. }
  37. $pages['status'] = $GLOBALS['strInnodbStat'];
  38. return $pages;
  39. }
  40. function getPage($id) {
  41. global $cfg;
  42. switch ($id) {
  43. case 'bufferpool':
  44. if (PMA_MYSQL_INT_VERSION < 50002) {
  45. return FALSE;
  46. }
  47. // rabus: The following query is only possible because we know
  48. // that we are on MySQL 5 here (checked above)!
  49. // side note: I love MySQL 5 for this. :-)
  50. $res = PMA_DBI_query('SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';');
  51. $status = array();
  52. while ($row = PMA_DBI_fetch_row($res)) {
  53. $status[$row[0]] = $row[1];
  54. }
  55. PMA_DBI_free_result($res);
  56. unset($res, $row);
  57. $output = '<table>' . "\n"
  58. . ' <thead>' . "\n"
  59. . ' <tr>' . "\n"
  60. . ' <th colspan="4">' . "\n"
  61. . ' ' . $GLOBALS['strBufferPoolUsage'] . "\n"
  62. . ' </th>' . "\n"
  63. . ' </tr>' . "\n"
  64. . ' </thead>' . "\n"
  65. . ' <tfoot>' . "\n"
  66. . ' <tr>' . "\n"
  67. . ' <th>' . "\n"
  68. . ' ' . $GLOBALS['strTotalUC'] . "\n"
  69. . ' </th>' . "\n"
  70. . ' <th colspan="3">' . "\n"
  71. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_total']) . '&nbsp;' . $GLOBALS['strInnoDBPages'] . '&nbsp;/ ' . join('&nbsp;', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n"
  72. . ' </th>' . "\n"
  73. . ' </tr>' . "\n"
  74. . ' </tfoot>' . "\n"
  75. . ' <tbody>' . "\n"
  76. . ' <tr>' . "\n"
  77. . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  78. . ' &nbsp;' . $GLOBALS['strFreePages'] . '&nbsp;' . "\n"
  79. . ' </td>' . "\n"
  80. . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  81. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_free']) . "\n"
  82. . ' </td>' . "\n"
  83. . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  84. . ' &nbsp;' . $GLOBALS['strDirtyPages'] . '&nbsp;' . "\n"
  85. . ' </td>' . "\n"
  86. . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  87. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_dirty']) . "\n"
  88. . ' </td>' . "\n"
  89. . ' </tr>' . "\n"
  90. . ' <tr>' . "\n"
  91. . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  92. . ' &nbsp;' . $GLOBALS['strDataPages'] . '&nbsp;' . "\n"
  93. . ' </td>' . "\n"
  94. . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  95. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_data']) . "\n"
  96. . ' </td>' . "\n"
  97. . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  98. . ' &nbsp;' . $GLOBALS['strPagesToBeFlushed'] . '&nbsp;' . "\n"
  99. . ' </td>' . "\n"
  100. . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  101. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_flushed']) . "\n"
  102. . ' </td>' . "\n"
  103. . ' </tr>' . "\n"
  104. . ' <tr>' . "\n"
  105. . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  106. . ' &nbsp;' . $GLOBALS['strBusyPages'] . '&nbsp;' . "\n"
  107. . ' </td>' . "\n"
  108. . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  109. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_misc']) . "\n"
  110. . ' </td>' . "\n"
  111. . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  112. . ' &nbsp;' . $GLOBALS['strLatchedPages'] . '&nbsp;' . "\n"
  113. . ' </td>' . "\n"
  114. . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  115. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_latched']) . "\n"
  116. . ' </td>' . "\n"
  117. . ' </tr>' . "\n"
  118. . ' </tbody>' . "\n"
  119. . '</table>' . "\n\n"
  120. . '<br />' . "\n\n"
  121. . '<table>' . "\n"
  122. . ' <thead>' . "\n"
  123. . ' <tr>' . "\n"
  124. . ' <th colspan="4">' . "\n"
  125. . ' ' . $GLOBALS['strBufferPoolActivity'] . "\n"
  126. . ' </th>' . "\n"
  127. . ' </tr>' . "\n"
  128. . ' </thead>' . "\n"
  129. . ' <tbody>' . "\n"
  130. . ' <tr>' . "\n"
  131. . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  132. . ' &nbsp;' . $GLOBALS['strReadRequests'] . '&nbsp;' . "\n"
  133. . ' </td>' . "\n"
  134. . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  135. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_read_requests']) . "\n"
  136. . ' </td>' . "\n"
  137. . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  138. . ' &nbsp;' . $GLOBALS['strWriteRequests'] . '&nbsp;' . "\n"
  139. . ' </td>' . "\n"
  140. . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  141. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_write_requests']) . "\n"
  142. . ' </td>' . "\n"
  143. . ' </tr>' . "\n"
  144. . ' <tr>' . "\n"
  145. . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  146. . ' &nbsp;' . $GLOBALS['strBufferReadMisses'] . '&nbsp;' . "\n"
  147. . ' </td>' . "\n"
  148. . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  149. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_reads']) . "\n"
  150. . ' </td>' . "\n"
  151. . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  152. . ' &nbsp;' . $GLOBALS['strBufferWriteWaits'] . '&nbsp;' . "\n"
  153. . ' </td>' . "\n"
  154. . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  155. . ' ' . htmlspecialchars($status['Innodb_buffer_pool_wait_free']) . "\n"
  156. . ' </td>' . "\n"
  157. . ' </tr>' . "\n"
  158. . ' <tr>' . "\n"
  159. . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  160. . ' &nbsp;' . $GLOBALS['strBufferReadMissesInPercent'] . '&nbsp;' . "\n"
  161. . ' </td>' . "\n"
  162. . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  163. . ' ' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . '&nbsp;%') . "\n"
  164. . ' </td>' . "\n"
  165. . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
  166. . ' &nbsp;' . $GLOBALS['strBufferWriteWaitsInPercent'] . '&nbsp;' . "\n"
  167. . ' </td>' . "\n"
  168. . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n"
  169. . ' ' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . '&nbsp;%') . "\n"
  170. . ' </td>' . "\n"
  171. . ' </tr>' . "\n"
  172. . ' </tbody>' . "\n"
  173. . '</table>' . "\n";
  174. return $output;
  175. case 'status':
  176. $res = PMA_DBI_query('SHOW INNODB STATUS;');
  177. $row = PMA_DBI_fetch_row($res);
  178. PMA_DBI_free_result($res);
  179. return '<pre>' . "\n"
  180. . htmlspecialchars($row[0]) . "\n"
  181. . '</pre>' . "\n";
  182. default:
  183. return FALSE;
  184. }
  185. }
  186. }
  187. ?>