if(!check_perms('site_debug')) { error(403); } //View schemas if (!empty($_GET['table'])) { $DB->query('SHOW TABLES'); $Tables =$DB->collect('Tables_in_'.SQLDB); if (!in_array($_GET['table'], $Tables)) { error(0); } $DB->query('SHOW CREATE TABLE '.db_string($_GET['table'])); list(,$Schema) = $DB->next_record(MYSQLI_NUM, false); header('Content-type: text/plain'); die($Schema); } //Cache the tables for 4 hours, makes sorting faster if (!$Tables = $Cache->get_value('database_table_stats')) { $DB->query('SHOW TABLE STATUS'); $Tables =$DB->to_array(); $Cache->cache_value('database_table_stats',$Tables,3600*4); } require(SERVER_ROOT.'/classes/class_charts.php'); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1,'Sort'=>1)); //Begin sorting $Sort = array(); switch (empty($_GET['order_by'])?'':$_GET['order_by']) { case 'name': foreach ($Tables as $Key => $Value) { $Pie->add($Value[0], $Value[6] + $Value[8]); $Sort[$Key] = $Value[0]; } break; case 'engine': foreach ($Tables as $Key => $Value) { $Pie->add($Value[0], $Value[6] + $Value[8]); $Sort[$Key] = $Value[1]; } break; case 'rows': foreach ($Tables as $Key => $Value) { $Pie->add($Value[0], $Value[4]); $Sort[$Key] = $Value[4]; } break; case 'rowsize': foreach ($Tables as $Key => $Value) { $Pie->add($Value[0], $Value[5]); $Sort[$Key] = $Value[5]; } break; case 'datasize': foreach ($Tables as $Key => $Value) { $Pie->add($Value[0], $Value[6]); $Sort[$Key] = $Value[6]; } break; case 'indexsize': foreach ($Tables as $Key => $Value) { $Pie->add($Value[0], $Value[8]); $Sort[$Key] = $Value[8]; } break; case 'totalsize': default: foreach ($Tables as $Key => $Value) { $Pie->add($Value[0], $Value[6] + $Value[8]); $Sort[$Key] = $Value[6] + $Value[8]; } } $Pie->generate(); if (!empty ($_GET['order_way']) && $_GET['order_way'] == 'asc') { $SortWay = SORT_ASC; } else { $SortWay = SORT_DESC; } array_multisort($Sort, $SortWay, $Tables); //End sorting View::show_header('Database Specifics'); ?>
Name | Engine | Rows | Row Size | Data Size | Index Size | Total Size | Tools |
=display_str($Name)?> | =display_str($Engine)?> | =number_format($Rows)?> | =Format::get_size($RowSize)?> | =Format::get_size($DataSize)?> | =Format::get_size($IndexSize)?> | =Format::get_size($DataSize + $IndexSize)?> | [Schema] |
=number_format($TotalRows)?> | =Format::get_size($TotalDataSize)?> | =Format::get_size($TotalIndexSize)?> | =Format::get_size($TotalDataSize + $TotalIndexSize)?> |