diff --git a/ChangeLog b/ChangeLog index f000a6fa5..390a6ac75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - patch #1821154, HTTP authentication: fix auth working with php/mod_fastcgi, thanks to yarodin - wrong default charset in case of broken session +- bug #1824506 [profiling] Profile command repeated on older MySQL servers 2.11.2.0 (2007-10-27) - patch #1791576 HTTP auth: support REDIRECT_REMOTE_USER, thanks to Allard diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 2264abeb0..2ca0e15d2 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -886,11 +886,11 @@ if (! defined('PMA_MINIMUM_COMMON')) { * (note: when $cfg['ServerDefault'] = 0, constant is not defined) */ - if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 50037 && isset($_REQUEST['profiling'])) { - $_SESSION['profiling'] = true; + if (PMA_profilingSupported() && isset($_REQUEST['profiling'])) { + $_SESSION['profiling'] = true; } elseif (isset($_REQUEST['profiling_form'])) { - // the checkbox was unchecked - unset($_SESSION['profiling']); + // the checkbox was unchecked + unset($_SESSION['profiling']); } } // end if !defined('PMA_MINIMUM_COMMON') diff --git a/libraries/common.lib.php b/libraries/common.lib.php index b80b02416..d33b504ef 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1208,6 +1208,25 @@ function PMA_showMessage($message, $sql_query = null) } // end of the 'PMA_showMessage()' function +/** + * Verifies if current MySQL server supports profiling + * + * @access public + * @return boolean whether profiling is supported + * + * @author Marc Delisle + */ +function PMA_profilingSupported() { + // 5.0.37 has profiling but for example, 5.1.20 does not + // (avoid a trip to the server for MySQL before 5.0.37) + // and do not set a constant as we might be switching servers + if (PMA_MYSQL_INT_VERSION >= 50037 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) { + return true; + } else { + return false; + } +} + /** * Displays a form with the Profiling checkbox * @@ -1217,9 +1236,7 @@ function PMA_showMessage($message, $sql_query = null) * @author Marc Delisle */ function PMA_profilingCheckbox($sql_query) { - // 5.0.37 has profiling but for example, 5.1.20 does not - // (avoid doing a fetch_value for MySQL before 5.0.37) - if (PMA_MYSQL_INT_VERSION >= 50037 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) { + if (PMA_profilingSupported()) { echo '