From 6174b881c52b0579f77c2d5e917a5f99b1e31d79 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Mon, 21 Jan 2008 11:19:21 +0000 Subject: [PATCH] cache MySQL version info --- libraries/database_interface.lib.php | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 3cb7e5391..8983e3c7e 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -805,18 +805,25 @@ function PMA_DBI_get_variable($var, $type = PMA_DBI_GETVAR_SESSION, $link = null function PMA_DBI_postConnect($link, $is_controluser = false) { if (! defined('PMA_MYSQL_INT_VERSION')) { - $mysql_version = PMA_DBI_fetch_value( - 'SELECT VERSION()', 0, 0, $link, PMA_DBI_QUERY_STORE); - if ($mysql_version) { - $match = explode('.', $mysql_version); - define('PMA_MYSQL_INT_VERSION', - (int) sprintf('%d%02d%02d', $match[0], $match[1], - intval($match[2]))); - define('PMA_MYSQL_STR_VERSION', $mysql_version); - unset($mysql_version, $match); + if (isset($_SESSION['PMA_MYSQL_INT_VERSION'])) { + define('PMA_MYSQL_INT_VERSION', $_SESSION['PMA_MYSQL_INT_VERSION']); + define('PMA_MYSQL_STR_VERSION', $_SESSION['PMA_MYSQL_STR_VERSION']); } else { - define('PMA_MYSQL_INT_VERSION', 50015); - define('PMA_MYSQL_STR_VERSION', '5.00.15'); + $mysql_version = PMA_DBI_fetch_value( + 'SELECT VERSION()', 0, 0, $link, PMA_DBI_QUERY_STORE); + if ($mysql_version) { + $match = explode('.', $mysql_version); + define('PMA_MYSQL_INT_VERSION', + (int) sprintf('%d%02d%02d', $match[0], $match[1], + intval($match[2]))); + define('PMA_MYSQL_STR_VERSION', $mysql_version); + unset($mysql_version, $match); + } else { + define('PMA_MYSQL_INT_VERSION', 50015); + define('PMA_MYSQL_STR_VERSION', '5.00.15'); + } + $_SESSION['PMA_MYSQL_INT_VERSION'] = PMA_MYSQL_INT_VERSION; + $_SESSION['PMA_MYSQL_STR_VERSION'] = PMA_MYSQL_STR_VERSION; } }