The Arcive of vBulletin Modifications Site. |
|
Quick Database Stats Details »»
|
|||||||||||||||||||||||||
Quick Database Stats
Author: assassingod Description: This hacks gives a quick list of database stats for your forums. Includes name and ammount of MB its using Final hack: https://vborg.vbsupport.ru/showthrea...threadid=51828 Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
Screenshot:
|
|
#3
|
|||
|
|||
|
hmm it doesn't work. it says my database is using 0 MB, But mine is really using 4MB
|
|
#4
|
|||
|
|||
|
From PHP.net user comments:
Code:
<?
/*
Function that returns whole size of a given MySQL database
Returns false if no db by that name is found
*/
function getdbsize($tdb) {
$db_host='localhost';
$db_usr='USER';
$db_pwd='XXXXXXXX';
$db = mysql_connect($db_host, $db_usr, $db_pwd) or die ("Error connecting to MySQL Server!\n");
mysql_select_db($tdb, $db);
$sql_result = "SHOW TABLE STATUS FROM " .$tdb;
$result = mysql_query($sql_result);
mysql_close($db);
if($result) {
$size = 0;
while ($data = mysql_fetch_array($result)) {
$size = $size + $data["Data_length"] + $data["Index_length"];
}
return $size;
}
else {
return FALSE;
}
}
?>
<?
/*
Implementation example
*/
$tmp = getdbsize("DATABASE_NAME");
if (!$tmp) { echo "ERROR!"; }
else { echo $tmp; }
?>
|
|
#5
|
||||
|
||||
|
Thanks DigitalDesktops for the letting me know it doesnt work
![]() Thanks filburt for the code! |
|
#6
|
||||
|
||||
|
Updated Code
Still not sure if its probably workin as of yet |
|
#7
|
||||
|
||||
|
It's not working properly for me.
It tells me that my db is vbulletin (Using 286524241 MB of space) In fact, it is using 273.3 MB I just now downloaded the code; so I assume I have the latest version. Amy |
|
#8
|
||||
|
||||
|
OK, Amy, I will look into that now. Thanks for testing it
|
|
#9
|
||||
|
||||
|
The result needs to be divided by 1,048,576 to get the correct answer in MB.
Amy |
|
#10
|
||||
|
||||
|
Replace
return $size; With: return ($size / 1048576 ); |
![]() |
|
|