. * * $Id$ * */ /** * based upon semmelstatz * Copyright (c) 2005-2009 Andreas 'Redunzl' Mueller (redunzl@gmx.de) * * @license http://www.gnu.org/licenses/gpl-2.0.html * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License (version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ if(current_user_can('manage_statz')) { global $wpdb; $pre = $wpdb->prefix; $lenpre = strlen($pre); $tablesstatus = $wpdb->get_results("SHOW TABLE STATUS"); print "
".semr_i18n("No.")." | "; print "".semr_i18n("Tables")." | "; print "".semr_i18n("Records")." | "; print "".semr_i18n("Data")." | "; print "".semr_i18n("Index")." | "; print "".semr_i18n("Data")." & ".semr_i18n("Index")." | "; print "".semr_i18n("Overhang")." | "; $row_usage = 0; $data_usage = 0; $index_usage = 0; $total_usage = 0; $overhead_usage = 0; foreach($tablesstatus as $key=>$tablestatus) { if(substr($tablestatus->Name,0,$lenpre) != $pre) continue; print "|
---|---|---|---|---|---|---|---|
".($key+1)." | "; print "".$tablestatus->Name." | "; print "".number_format($tablestatus->Rows,0,',','.')." | "; print "".number_format($tablestatus->Data_length/1024,0,',','.')." kb | "; print "".number_format($tablestatus->Index_length/1024,0,',','.')." kb | "; print "".number_format(($tablestatus->Data_length + $tablestatus->Index_length)/1024,0,',','.')." kb | "; if($tablestatus->Data_free > 0) { print ""; print " ".number_format($tablestatus->Data_free/1024,2,',','.')." kb"; print " | "; } else { print "-- | "; } $row_usage += $tablestatus->Rows; $data_usage += $tablestatus->Data_length; $index_usage += $tablestatus->Index_length; $total_usage += $tablestatus->Data_length + $tablestatus->Index_length; $overhead_usage += $tablestatus->Data_free; echo '
".semr_i18n("Total")." | "; print ""; print " | ".number_format($row_usage,0,',','.')." | "; print "".number_format($data_usage/1024,0,',','.')." kb | "; print "".number_format($index_usage/1024,0,',','.')." kb | "; print "".number_format($total_usage/1024,0,',','.')." kb | "; print "".number_format($overhead_usage/1024,2,',','.')." kb | "; print "|
"; printf(semr_i18n("Only the WORDPRESS tables belonging to the blog %s will be shown."), get_option('blogname')); print " |
No permission to access this area
'; } ?>