From 4a3a83e40c2abde3418100ad9c94c844abc2bbad Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Mon, 21 Jan 2008 11:51:53 +0000 Subject: [PATCH] cache MySQL profiling support information --- libraries/common.lib.php | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 418aebac4..6fa45dc3e 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1200,20 +1200,31 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice') /** * Verifies if current MySQL server supports profiling * + * @uses $_SESSION['profiling_supported'] for caching + * @uses PMA_DBI_fetch_value() + * @uses PMA_MYSQL_INT_VERSION + * @uses defined() * @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 (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 50037 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) { - return true; - } else { - return false; +function PMA_profilingSupported() +{ + if (! isset($_SESSION['profiling_supported'])) { + // 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 (defined('PMA_MYSQL_INT_VERSION') + && PMA_MYSQL_INT_VERSION >= 50037 + && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'profiling'")) { + $_SESSION['profiling_supported'] = true; + } else { + $_SESSION['profiling_supported'] = false; + } } + + return $_SESSION['profiling_supported']; } /** @@ -1224,7 +1235,8 @@ function PMA_profilingSupported() { * * @author Marc Delisle */ -function PMA_profilingCheckbox($sql_query) { +function PMA_profilingCheckbox($sql_query) +{ if (PMA_profilingSupported()) { echo '
' . "\n"; echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); @@ -1244,7 +1256,8 @@ function PMA_profilingCheckbox($sql_query) { * * @author Marc Delisle */ -function PMA_profilingResults($profiling_results) { +function PMA_profilingResults($profiling_results) +{ echo '
' . $GLOBALS['strProfiling'] . '' . "\n"; echo '' . "\n"; echo ' ' . "\n"; @@ -2302,7 +2315,7 @@ function PMA_generate_html_radio($html_field_name, $choices, $checked_choice = ' } /** - * Generates a slider effect (Mootools) + * Generates a slider effect (Mootools) * * @uses $GLOBALS['cfg']['InitialSlidersStatus'] * @param string $id the id of the
on which to apply the effect @@ -2331,9 +2344,9 @@ function PMA_generate_slider_effect($id, $message) { mySlide.toggle(); e.stop(); }); - }); + }); // ]]> -