TBDev Forum
Programming board
Main Page Forum Rules Privacy Policy Members Contact Us
Welcome Guest (Login | Register)
TBDev Forum TBDev.net - Mods & hacks Mods In Progress Mysql Table/Overhead Overview
Page 1 2 3 4 5 6 7 8 9 10

Mysql Table/Overhead Overview

2006-03-29 05:23:00
Group: Member
Posts: 465
Topics participated: 170
Topics started: 44
First post: 2006-03-05 06:30:00
Last post: 2008-12-08 08:05:00
i get this

Can't read dir of './bittorrent/' (Errcode: 2)

and its not a chmod problem..
 
2006-03-29 07:47:00
Group: Member
Posts: 20
Topics participated: 13
Topics started: 0
First post: 2006-03-29 07:47:00
Last post: 2007-12-16 16:37:00
yes this is no chmod error you must in this file find this:
$res = @mysql_query('SHOW TABLE STATUS FROM `bittorrent`') or Die(mysql_error());

and change bittorrent to name your database
 
2006-03-29 09:01:00
Group: Member
Posts: 2312
Topics participated: 1240
Topics started: 124
First post: 2006-02-25 21:12:00
Last post: 2009-01-03 14:56:00
Yep! As that Boodahvista...budhabloke, whats-his-name geezer said! :P
 
2006-04-09 03:01:00
Group: Member
Posts: 93
Topics participated: 48
Topics started: 10
First post: 2006-03-30 22:48:00
Last post: 2007-04-10 04:35:00
Thanks! works great!
 
2006-04-09 22:15:00
Group: Member
Posts: 328
Topics participated: 151
Topics started: 9
First post: 2006-02-25 02:06:00
Last post: 2008-11-14 07:15:00
Yep! As that Boodahvista...budhabloke, whats-his-name geezer said! :P


*bodhisattva chases CoLdFuSiOn with his walking cane*
 
2006-04-23 16:04:00
Group: Member
Posts: 99
Topics participated: 53
Topics started: 3
First post: 2006-03-05 12:31:00
Last post: 2006-10-08 02:36:00
Thanks, I will give it a try later :-D
 
2006-09-23 13:53:00
Group: Member
Posts: 285
Topics participated: 170
Topics started: 29
First post: 2006-03-14 10:00:00
Last post: 2008-11-06 20:17:00
Thanks this mod is very nice :)
 
2006-09-25 12:18:00
Group: Member
Posts: 24
Topics participated: 15
Topics started: 3
First post: 2006-09-09 12:51:00
Last post: 2008-10-15 22:20:00
when i try optimais table from thid mod i have error ! in browse adres i got thiss \/mysql_overview.php?Do=F

how to remove this slash ? here is my code


php
/* $Id: mysql_overview.php,v 1.01 2005/08/05 19:11:48 CoLdFuSiOn Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:


require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();

/**
* Checks if the user is allowed to do what he tries to...
*/
if (get_user_class() < UC_SYSOP)
stderr("Error", "Permission denied.");

//Do we wanna continue here, or skip to just the overview?
if (isset($_GET['Do']) && isset($_GET['table'])) {
$Do = ($_GET['Do'] === "T") ? sqlesc($_GET['Do']) : ""; //for later use!
//Make sure the GET only has alpha letters and nothing else
if(!ereg('[^A-Za-z_]+', $_GET['table'])) {
$Table = '`'.$_GET['table'].'`';//add backquotes to GET or we is doomed!
}else{
print("Pig Dog!");//Silly boy doh!!
exit;
}

$sql = "OPTIMIZE TABLE $Table";
//preg match the sql incase it was hijacked somewhere!(will use CHECK|ANALYZE|REPAIR|later
if (preg_match('@^(CHECK|ANALYZE|REPAIR|OPTIMIZE)[[:space:]]TABLE[[:space:]]'.$Table.'$@i', $sql)) {
//all good? Do it!
@mysql_query($sql) or die("Something was not right!
Query: " . $sql . "
Error: (" . mysql_errno() . ") " . htmlspecialchars(mysql_error()));
//all done, redirect back to calling page
$return_url = "mysql_overview.php?Do=F";
header("Location: http://" . $_SERVER['HTTP_HOST']
. dirname($_SERVER['PHP_SELF'])
. "/" . $return_url);
exit;
}
}
//byteunit array to prime formatByteDown function
$GLOBALS["byteUnits"] = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');

////////////////// FUNCTION LIST /////////////////////////

function formatByteDown($value, $limes = 2, $comma = 0)
{
$dh = pow(10, $comma);
$li = pow(10, $limes);
$return_value = $value;
$unit = $GLOBALS['byteUnits'][0];

for ( $d = 6, $ex = 15; $d >= 1; $d--, $ex-=3 ) {
if (isset($GLOBALS['byteUnits'][$d]) && $value >= $li * pow(10, $ex)) {
$value = round($value / ( pow(1024, $d) / $dh) ) /$dh;
$unit = $GLOBALS['byteUnits'][$d];
break 1;
} // end if
} // end for

if ($unit != $GLOBALS['byteUnits'][0]) {
$return_value = number_format($value, $comma, '.', ',');
} else {
$return_value = number_format($value, 0, '.', ',');
}

return array($return_value, $unit);
} // end of the 'formatByteDown' function
////////////////// END FUNCTION LIST /////////////////////////


stdhead("Stats");

/**
* Displays the sub-page heading
*/
echo '

' . "\n"
. ' Mysql Server Table Status' . "\n"
. '

' . "\n";
?>


































$count = 0;
/**
* Sends the query and buffers the result
*/
$res = @mysql_query('SHOW TABLE STATUS FROM `tsdev`') or Die(mysql_error());
while ($row = mysql_fetch_array($res)) {
list($formatted_Avg, $formatted_Abytes) = formatByteDown($row['Avg_row_length']);
list($formatted_Dlength, $formatted_Dbytes) = formatByteDown($row['Data_length']);
list($formatted_Ilength, $formatted_Ibytes) = formatByteDown($row['Index_length']);
list($formatted_Dfree, $formatted_Fbytes) = formatByteDown($row['Data_free']);
$tablesize = ($row['Data_length']) + ($row['Index_length']);
list($formatted_Tsize, $formatted_Tbytes) = formatByteDown($tablesize, 3, ($tablesize > 0) ? 1 : 0);

$thispage = "?Do=T&table=".$row['Name'];
$overhead = ($formatted_Dfree > 0) ? "".$formatted_Dfree." ".$formatted_Fbytes."" : $formatted_Dfree." ".$formatted_Fbytes;

echo "".
"".
"".
"".
"".
"".
"".
"";
//do sums
$count++;

}//end while
echo "";
?>

NameSizeRowsAvg row lengthData lengthIndex lengthOverhead
{$row['Name']}{$formatted_Tsize} {$formatted_Tbytes}{$row['Rows']}{$formatted_Avg} {$formatted_Abytes}{$formatted_Dlength} {$formatted_Dbytes}{$formatted_Ilength} {$formatted_Ibytes}{$overhead}
Row Format: {$row['Row_format']}".
"
Create Time: {$row['Create_time']}".
"
Update Time: {$row['Update_time']}".
"
Check Time: {$row['Check_time']}
Tables: {$count}If it's RED it probably needs optimising!!



stdfoot();
?>


Sorry for my bad English !
 
2006-09-25 13:19:00
Group: Member
Posts: 2312
Topics participated: 1240
Topics started: 124
First post: 2006-02-25 21:12:00
Last post: 2009-01-03 14:56:00
Not sure why you'd get that. Only thing I can think of is you messed up the code somehow, or $_SERVER['HTTP_HOST'] is getting changed via bittorrent.php to contain a forward slash.

You could hardcode the header(location: ... )
 
2006-10-03 19:29:00
Group: Member
Posts: 48
Topics participated: 20
Topics started: 4
First post: 2006-09-18 21:23:00
Last post: 2008-04-06 04:54:00
yeah great one

works just nice but can you tell me what it exactly does to optimize the table and what are the benefits from that.
 

Similar threads

Topic Posts Last post
MySQL Repair Table Cron Job 2 2006-03-08 18:49:00
Administrative message overview 33 2008-10-22 01:57:00
Statusbar in table 1 2007-02-20 20:42:00
Help with sendmessage table! 3 2007-11-15 21:01:00
Table Problem! 4 2007-11-21 02:22:00