1
0
Fork 0
SemmelstatzR/trunk/semmelstatz-database.php

82 Zeilen
Kein EOL
3,4 KiB
PHP

<?php
/***********************************************
* *
* semmelstatz_database.php v3.3 *
* Copyright: © 2005-2009 kopfhoch-studio *
* *
***********************************************/
if(!current_user_can('manage_statz')) {
die('Zugriff verweigert');
}
global $wpdb;
$pre = $wpdb->prefix; $lenpre = strlen($pre);
$tablesstatus = $wpdb->get_results("SHOW TABLE STATUS");
print "<div class='wrap'>";
print "<div><a name='top'></a></div>";
print "<div id='icon-semmelstatz' class='icon32'><br /></div>";
print "<h2>Semmelstatz &rsaquo; Datenbank</h2>";
print "<div class='statz'>Datenbank</div>";
print "<table class='statzelement'>";
print "<tr>";
print "<th style='text-align:center;width:6%'>Nr.</th>";
print "<th style='text-align:left;width:20%'>Tabellen</th>";
print "<th style='text-align:right;width:10%'>Datens&auml;tze</th>";
print "<th style='text-align:right;width:10%'>Daten</th>";
print "<th style='text-align:right;width:10%'>Index</th>";
print "<th style='text-align:right;width:10%'>Daten & Index</th>";
print "<th style='text-align:right;width:7%'>&Uuml;berhang</th>";
foreach($tablesstatus as $key=>$tablestatus) {
if(substr($tablestatus->Name,0,$lenpre) != $pre) continue;
print "<tr"; if(1&$key) print " class='alternate'"; print ">";
print "<td style='text-align:center;'>".($key+1)."</td>";
print "<td style='text-align:left;'>".$tablestatus->Name."</td>";
print "<td style='text-align:right;'>".number_format($tablestatus->Rows,0,',','.')."</td>";
print "<td style='text-align:right;'>".number_format($tablestatus->Data_length/1024,0,',','.')."&nbsp;kb</td>";
print "<td style='text-align:right;'>".number_format($tablestatus->Index_length/1024,0,',','.')."&nbsp;kb</td>";
print "<td style='text-align:right;'>".number_format(($tablestatus->Data_length + $tablestatus->Index_length)/1024,0,',','.')."&nbsp;kb</td>";
if($tablestatus->Data_free > 0) {
print "<td style='color:#ff0000;text-align:right;'>";
print "&nbsp;".number_format($tablestatus->Data_free/1024,2,',','.')."&nbsp;kb";
print "</td>";
}
else {
print "<td style='text-align:right;'>--</td>";
}
$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 '</tr>';
}
print "<tr>";
print "<th style='text-align:center;'>Gesamt</th>";
print "<th style='text-align:left;'>&nbsp;</th>";
print "<th style='text-align:right;'>".number_format($row_usage,0,',','.')."</th>";
print "<th style='text-align:right;'>".number_format($data_usage/1024,0,',','.')."&nbsp;kb</th>";
print "<th style='text-align:right;'>".number_format($index_usage/1024,0,',','.')."&nbsp;kb</th>";
print "<th style='text-align:right;'>".number_format($total_usage/1024,0,',','.')."&nbsp;kb</th>";
print "<th style='color:#ff0000;text-align:right;'>".number_format($overhead_usage/1024,2,',','.')."&nbsp;kb</th>";
print "</tr>";
print "<tr><td colspan='7'><p align='right'>Es werden ausschlie&szlig;lich die WORDPRESS-Tabellen angezeigt, die zum Blog <b>'".get_option('blogname')."'</b> geh&ouml;ren.</p></td></tr>";
print "</table>";
print "<hr />";
sem_showCopyright();
print "</div>";
?>