The branch, master has been updated via 52299e0658c4f21fbcfdae60c5f26b587d2af4d3 (commit) via 2d540f73b33740b3ecfbc24d6bdb4b204c998c47 (commit) via e264e9f112d917c4170ad432f9f61660c9eddbb4 (commit) via d421c85a5c9912fdc0e728a811940870c5f7dc9f (commit) via 4c957837eb6c90259ca6afb80257a31ce33685e0 (commit) from 864bf00d97d70001d6446ed87389a8b3942360d7 (commit)
- Log ----------------------------------------------------------------- commit 52299e0658c4f21fbcfdae60c5f26b587d2af4d3 Author: Piotr Przybylski piotrprz@gmail.com Date: Tue Apr 5 16:02:46 2011 +0200
Drizzle-compatible Status tab
commit 2d540f73b33740b3ecfbc24d6bdb4b204c998c47 Author: Piotr Przybylski piotrprz@gmail.com Date: Tue Apr 5 16:02:16 2011 +0200
Drizzle-compatible Processes tab
commit e264e9f112d917c4170ad432f9f61660c9eddbb4 Author: Piotr Przybylski piotrprz@gmail.com Date: Tue Apr 5 16:01:35 2011 +0200
Hide password change for Drizzle
commit d421c85a5c9912fdc0e728a811940870c5f7dc9f Author: Piotr Przybylski piotrprz@gmail.com Date: Tue Apr 5 16:00:44 2011 +0200
Make Charsets tab read charset and collation info from information_schema (MySQL) / data_dictionary (Drizzle) instead of SHOW statements
commit 4c957837eb6c90259ca6afb80257a31ce33685e0 Author: Piotr Przybylski piotrprz@gmail.com Date: Tue Apr 5 15:58:11 2011 +0200
Introduce PMA_DRIZZLE constant
-----------------------------------------------------------------------
Summary of changes: libraries/database_interface.lib.php | 4 ++- libraries/mysql_charsets.lib.php | 52 +++++++++++++++++----------------- main.php | 25 ++++++++-------- server_processlist.php | 16 ++++++++++- server_status.php | 9 ++++- 5 files changed, 64 insertions(+), 42 deletions(-)
diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 192cf0e..c1b34e0 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -985,10 +985,12 @@ function PMA_DBI_postConnect($link, $is_controluser = false) PMA_cacheSet('PMA_MYSQL_MAJOR_VERSION', PMA_MYSQL_MAJOR_VERSION, true); PMA_cacheSet('PMA_MYSQL_STR_VERSION', PMA_MYSQL_STR_VERSION, true); } + // detect Drizzle by version number (year.month.day.?patch-version) + define('PMA_DRIZZLE', PMA_MYSQL_MAJOR_VERSION >= 2009); }
/* Skip charsets for Drizzle */ - if (PMA_MYSQL_MAJOR_VERSION < 2009) { + if (!PMA_DRIZZLE) { if (! empty($GLOBALS['collation_connection'])) { PMA_DBI_query("SET CHARACTER SET 'utf8';", $link, PMA_DBI_QUERY_STORE); PMA_DBI_query("SET collation_connection = '" . PMA_sqlAddslashes($GLOBALS['collation_connection']) . "';", $link, PMA_DBI_QUERY_STORE); diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index 5663dd9..45fd55a 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -11,26 +11,18 @@ if (! defined('PHPMYADMIN')) { /** * */ -if (PMA_MYSQL_MAJOR_VERSION >= 2009) { - /* There are no charsets in Drizzle */ - $GLOBALS['mysql_charsets'] = array(); - $GLOBALS['mysql_charsets_descriptions'] = array('utf8' => 'UTF-8 Unicode'); - $GLOBALS['mysql_charsets_count'] = 0; - $GLOBALS['mysql_charsets_available'] = array(); - $GLOBALS['mysql_collations'] = array(); - $GLOBALS['mysql_default_collations'] = array(); - $GLOBALS['mysql_collations_flat'] = array(); - $GLOBALS['mysql_collations_count'] = 0; - $GLOBALS['mysql_collations_available'] = array(); -} elseif (! PMA_cacheExists('mysql_charsets_count', true)) { - $res = PMA_DBI_query('SHOW CHARACTER SET;'); +if (! PMA_cacheExists('mysql_charsets_count', true)) { + $sql = PMA_DRIZZLE + ? 'SELECT * FROM data_dictionary.CHARACTER_SETS' + : 'SELECT * FROM information_schema.CHARACTER_SETS'; + $res = PMA_DBI_query($sql);
$mysql_charsets = array(); while ($row = PMA_DBI_fetch_assoc($res)) { - $mysql_charsets[] = $row['Charset']; + $mysql_charsets[] = $row['CHARACTER_SET_NAME']; // never used //$mysql_charsets_maxlen[$row['Charset']] = $row['Maxlen']; - $mysql_charsets_descriptions[$row['Charset']] = $row['Description']; + $mysql_charsets_descriptions[$row['CHARACTER_SET_NAME']] = $row['DESCRIPTION']; } PMA_DBI_free_result($res);
@@ -40,26 +32,34 @@ if (PMA_MYSQL_MAJOR_VERSION >= 2009) { $mysql_collations = array_flip($mysql_charsets); $mysql_default_collations = $mysql_collations_flat = $mysql_charsets_available = $mysql_collations_available = array();
- $res = PMA_DBI_query('SHOW COLLATION;'); + $sql = PMA_DRIZZLE + ? 'SELECT * FROM data_dictionary.COLLATIONS' + : 'SELECT * FROM information_schema.COLLATIONS'; + $res = PMA_DBI_query($sql); while ($row = PMA_DBI_fetch_assoc($res)) { - if (!is_array($mysql_collations[$row['Charset']])) { - $mysql_collations[$row['Charset']] = array($row['Collation']); + if (!is_array($mysql_collations[$row['CHARACTER_SET_NAME']])) { + $mysql_collations[$row['CHARACTER_SET_NAME']] = array($row['COLLATION_NAME']); } else { - $mysql_collations[$row['Charset']][] = $row['Collation']; + $mysql_collations[$row['CHARACTER_SET_NAME']][] = $row['COLLATION_NAME']; } - $mysql_collations_flat[] = $row['Collation']; - if ((isset($row['D']) && $row['D'] == 'Y') || (isset($row['Default']) && $row['Default'] == 'Yes')) { - $mysql_default_collations[$row['Charset']] = $row['Collation']; + $mysql_collations_flat[] = $row['COLLATION_NAME']; + if ($row['IS_DEFAULT'] == 'Yes') { + $mysql_default_collations[$row['CHARACTER_SET_NAME']] = $row['COLLATION_NAME']; } //$mysql_collations_available[$row['Collation']] = !isset($row['Compiled']) || $row['Compiled'] == 'Yes'; - $mysql_collations_available[$row['Collation']] = TRUE; - $mysql_charsets_available[$row['Charset']] = - !empty($mysql_charsets_available[$row['Charset']]) - || !empty($mysql_collations_available[$row['Collation']]); + $mysql_collations_available[$row['COLLATION_NAME']] = true; + $mysql_charsets_available[$row['CHARACTER_SET_NAME']] = + !empty($mysql_charsets_available[$row['CHARACTER_SET_NAME']]) + || !empty($mysql_collations_available[$row['COLLATION_NAME']]); } PMA_DBI_free_result($res); unset($res, $row);
+ if (PMA_DRIZZLE && isset($mysql_collations['utf8_general_ci']) && isset($mysql_collations['utf8'])) { + $mysql_collations['utf8'] = $mysql_collations['utf8_general_ci']; + unset($mysql_collations['utf8_general_ci']); + } + $mysql_collations_count = count($mysql_collations_flat); sort($mysql_collations_flat, SORT_STRING); foreach ($mysql_collations AS $key => $value) { diff --git a/main.php b/main.php index c29a508..e678d88 100644 --- a/main.php +++ b/main.php @@ -85,19 +85,20 @@ if ($server > 0 if ($server > 0) { require_once './libraries/check_user_privileges.lib.php';
- // Logout for advanced authentication - if ($cfg['Server']['auth_type'] != 'config') { - if ($cfg['ShowChgPassword']) { - if ($GLOBALS['cfg']['AjaxEnable']) { - $conditional_class = 'ajax'; - } else { - $conditional_class = null; + if (!PMA_DRIZZLE) { + // Logout for advanced authentication + if ($cfg['Server']['auth_type'] != 'config') { + if ($cfg['ShowChgPassword']) { + if ($GLOBALS['cfg']['AjaxEnable']) { + $conditional_class = 'ajax'; + } else { + $conditional_class = null; + } + PMA_printListItem(__('Change password'), 'li_change_password', + './user_password.php?' . $common_url_query, null, null, 'change_password_anchor', null, $conditional_class); } - PMA_printListItem(__('Change password'), 'li_change_password', - './user_password.php?' . $common_url_query, null, null, 'change_password_anchor', null, $conditional_class); - } - } // end if - if (PMA_MYSQL_MAJOR_VERSION < 2009) { + } // end if + echo ' <li id="li_select_mysql_collation">'; echo ' <form method="post" action="index.php" target="_parent">' . "\n" . PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection') diff --git a/server_processlist.php b/server_processlist.php index ea31a76..12959d1 100644 --- a/server_processlist.php +++ b/server_processlist.php @@ -52,11 +52,16 @@ $result = PMA_DBI_query($sql_query); ?> <table id="tableprocesslist" class="data"> <thead> -<tr><td><a href="<?php echo $full_text_link; ?>" +<tr> + <?php if (!PMA_DRIZZLE): ?> + <td><a href="<?php echo $full_text_link; ?>" title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>"> <img src="<?php echo $pmaThemeImage . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png" alt="<?php echo empty($_REQUEST['full']) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>" /> </a></td> + <?php else: ?> + <th></th> + <?php endif; ?> <th><?php echo __('ID'); ?></th> <th><?php echo __('User'); ?></th> <th><?php echo __('Host'); ?></th> @@ -71,6 +76,15 @@ $result = PMA_DBI_query($sql_query); <?php $odd_row = true; while($process = PMA_DBI_fetch_assoc($result)) { + if (PMA_DRIZZLE) { + // Drizzle uses uppercase keys + foreach ($process as $k => $v) { + $k = $k !== 'DB' + ? $k = ucfirst(strtolower($k)) + : 'db'; + $process[$k] = $v; + } + } $url_params['kill'] = $process['Id']; $kill_process = 'server_processlist.php' . PMA_generate_common_url($url_params); ?> diff --git a/server_status.php b/server_status.php index c67c63a..3b44a4a 100644 --- a/server_status.php +++ b/server_status.php @@ -653,8 +653,11 @@ $used_queries = $sections['com']['vars']; // reverse sort by value to show most used statements first arsort($used_queries); // remove all zero values from the end -while (end($used_queries) == 0) { - array_pop($used_queries); +// variable empty for Drizzle +if ($used_queries) { + while (end($used_queries) == 0) { + array_pop($used_queries); + } }
// number of tables to split values into @@ -713,6 +716,7 @@ foreach ($used_queries as $name => $value) { <div class="clearfloat"></div> </div>
+<?php if ($used_queries): ?> <div id="serverstatusquerieschart"> <?php if (empty($_REQUEST["query_chart"])) { @@ -726,6 +730,7 @@ foreach ($used_queries as $name => $value) { } ?> </div> +<?php endif; ?>
<div id="serverstatussection"> <?php
hooks/post-receive