From ca10febbbd24f5bc44c5efd9da23aed909e120ea Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 17 Aug 2001 16:08:18 +0000 Subject: [PATCH] Do a MySQL version check before running table status git-svn-id: file:///svn/phpbb/trunk@898 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/index.php | 58 +++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/phpBB/admin/index.php b/phpBB/admin/index.php index 8f2c6d9b81..4abbca91e5 100644 --- a/phpBB/admin/index.php +++ b/phpBB/admin/index.php @@ -211,33 +211,49 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' ) // if(SQL_LAYER == 'mysql') { - $sql = "SHOW TABLE STATUS FROM " . $dbname; - if(!$result = $db->sql_query($sql)) + $sql = "SELECT VERSION() AS mysql_version"; + if($result = $db->sql_query($sql)) { - message_die(GENERAL_ERROR, "Couldn't obtain table information.", "", __LINE__, __FILE__, $sql); - } - $tabledata_ary = $db->sql_fetchrowset($result); - - $dbsize = 0; - for($i = 0; $i < count($tabledata_ary); $i++) - { - if($tabledata_ary[$i]['Type'] != "MRG_MyISAM" && strstr($tabledata_ary[$i]['Name'], $table_prefix) ) + list($version) = $db->sql_fetchrow($result); + if( ereg("^3\.23", $version) ) { - $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; - } - } + $sql = "SHOW TABLE STATUS FROM " . $dbname; + if(!$result = $db->sql_query($sql)) + { + message_die(GENERAL_ERROR, "Couldn't obtain table information.", "", __LINE__, __FILE__, $sql); + } + $tabledata_ary = $db->sql_fetchrowset($result); - if($dbsize >= 1048576) - { - $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 )); - } - else if($dbsize >= 1024) - { - $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 )); + $dbsize = 0; + for($i = 0; $i < count($tabledata_ary); $i++) + { + if($tabledata_ary[$i]['Type'] != "MRG_MyISAM" && strstr($tabledata_ary[$i]['Name'], $table_prefix) ) + { + $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; + } + } + + if($dbsize >= 1048576) + { + $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 )); + } + else if($dbsize >= 1024) + { + $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 )); + } + else + { + $dbsize = sprintf("%.2f Bytes", $dbsize); + } + } + else + { + $dbsize = $lang['Not_available']; + } } else { - $dbsize = sprintf("%.2f Bytes", $dbsize); + $dbsize = $lang['Not_available']; } } else