mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-15 03:55:23 +02:00
Do a MySQL version check before running table status
git-svn-id: file:///svn/phpbb/trunk@898 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
185faf1328
commit
ca10febbbd
@ -211,33 +211,49 @@ elseif( $HTTP_GET_VARS['pane'] == 'right' )
|
|||||||
//
|
//
|
||||||
if(SQL_LAYER == 'mysql')
|
if(SQL_LAYER == 'mysql')
|
||||||
{
|
{
|
||||||
$sql = "SHOW TABLE STATUS FROM " . $dbname;
|
$sql = "SELECT VERSION() AS mysql_version";
|
||||||
if(!$result = $db->sql_query($sql))
|
if($result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
message_die(GENERAL_ERROR, "Couldn't obtain table information.", "", __LINE__, __FILE__, $sql);
|
list($version) = $db->sql_fetchrow($result);
|
||||||
}
|
if( ereg("^3\.23", $version) )
|
||||||
$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) )
|
|
||||||
{
|
{
|
||||||
$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 = 0;
|
||||||
{
|
for($i = 0; $i < count($tabledata_ary); $i++)
|
||||||
$dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 ));
|
{
|
||||||
}
|
if($tabledata_ary[$i]['Type'] != "MRG_MyISAM" && strstr($tabledata_ary[$i]['Name'], $table_prefix) )
|
||||||
else if($dbsize >= 1024)
|
{
|
||||||
{
|
$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
|
||||||
$dbsize = sprintf("%.2f KB", ( $dbsize / 1024 ));
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
$dbsize = sprintf("%.2f Bytes", $dbsize);
|
$dbsize = $lang['Not_available'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user