| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
if(!current_user_can('manage_database')) { |
|---|
| 22 |
die('Access Denied'); |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
$base_name = plugin_basename('wp-dbmanager/database-manager.php'); |
|---|
| 28 |
$base_page = 'admin.php?page='.$base_name; |
|---|
| 29 |
$backup = array(); |
|---|
| 30 |
$backup_options = get_option('dbmanager_options'); |
|---|
| 31 |
$backup['date'] = current_time('timestamp'); |
|---|
| 32 |
$backup['mysqldumppath'] = $backup_options['mysqldumppath']; |
|---|
| 33 |
$backup['mysqlpath'] = $backup_options['mysqlpath']; |
|---|
| 34 |
$backup['path'] = $backup_options['path']; |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
$sqlversion = $wpdb->get_var("SELECT VERSION() AS version"); |
|---|
| 39 |
?> |
|---|
| 40 |
<?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?> |
|---|
| 41 |
<!-- Database Information --> |
|---|
| 42 |
<div class="wrap"> |
|---|
| 43 |
<h2><?php _e('Database Information', 'wp-dbmanager'); ?></h2> |
|---|
| 44 |
<br style="clear" /> |
|---|
| 45 |
<table class="widefat"> |
|---|
| 46 |
<thead> |
|---|
| 47 |
<tr> |
|---|
| 48 |
<th><?php _e('Setting', 'wp-dbmanager'); ?></th> |
|---|
| 49 |
<th><?php _e('Value', 'wp-dbmanager'); ?></th> |
|---|
| 50 |
</tr> |
|---|
| 51 |
</thead> |
|---|
| 52 |
<tr> |
|---|
| 53 |
<td><?php _e('Database Host', 'wp-dbmanager'); ?></td> |
|---|
| 54 |
<td><?php echo DB_HOST; ?></td> |
|---|
| 55 |
</tr> |
|---|
| 56 |
<tr class="alternate"> |
|---|
| 57 |
<td><?php _e('Database Name', 'wp-dbmanager'); ?></td> |
|---|
| 58 |
<td><?php echo DB_NAME; ?></td> |
|---|
| 59 |
</tr> |
|---|
| 60 |
<tr> |
|---|
| 61 |
<td><?php _e('Database User', 'wp-dbmanager'); ?></td> |
|---|
| 62 |
<td><?php echo DB_USER; ?></td> |
|---|
| 63 |
</tr> |
|---|
| 64 |
<tr class="alternate"> |
|---|
| 65 |
<td><?php _e('Database Type', 'wp-dbmanager'); ?></td> |
|---|
| 66 |
<td>MYSQL</td> |
|---|
| 67 |
</tr> |
|---|
| 68 |
<tr> |
|---|
| 69 |
<td><?php _e('Database Version', 'wp-dbmanager'); ?></td> |
|---|
| 70 |
<td>v<?php echo $sqlversion; ?></td> |
|---|
| 71 |
</tr> |
|---|
| 72 |
</table> |
|---|
| 73 |
</div> |
|---|
| 74 |
<p> </p> |
|---|
| 75 |
|
|---|
| 76 |
<div class="wrap"> |
|---|
| 77 |
<h2><?php _e('Tables Information', 'wp-dbmanager'); ?></h2> |
|---|
| 78 |
<br style="clear" /> |
|---|
| 79 |
<table class="widefat"> |
|---|
| 80 |
<thead> |
|---|
| 81 |
<tr> |
|---|
| 82 |
<th><?php _e('No.', 'wp-dbmanager'); ?></th> |
|---|
| 83 |
<th><?php _e('Tables', 'wp-dbmanager'); ?></th> |
|---|
| 84 |
<th><?php _e('Records', 'wp-dbmanager'); ?></th> |
|---|
| 85 |
<th><?php _e('Data Usage', 'wp-dbmanager'); ?></th> |
|---|
| 86 |
<th><?php _e('Index Usage', 'wp-dbmanager'); ?></th> |
|---|
| 87 |
<th><?php _e('Overhead', 'wp-dbmanager'); ?></th> |
|---|
| 88 |
</tr> |
|---|
| 89 |
</thead> |
|---|
| 90 |
<?php |
|---|
| 91 |
|
|---|
| 92 |
if($sqlversion >= '3.23') { |
|---|
| 93 |
$tablesstatus = $wpdb->get_results("SHOW TABLE STATUS"); |
|---|
| 94 |
foreach($tablesstatus as $tablestatus) { |
|---|
| 95 |
if($no%2 == 0) { |
|---|
| 96 |
$style = ''; |
|---|
| 97 |
} else { |
|---|
| 98 |
$style = ' class="alternate"'; |
|---|
| 99 |
} |
|---|
| 100 |
$no++; |
|---|
| 101 |
echo "<tr$style>\n"; |
|---|
| 102 |
echo "<td>$no</td>\n"; |
|---|
| 103 |
echo "<td>$tablestatus->Name</td>\n"; |
|---|
| 104 |
echo '<td>'.number_format($tablestatus->Rows).'</td>'."\n"; |
|---|
| 105 |
echo '<td>'.format_size($tablestatus->Data_length).'</td>'."\n"; |
|---|
| 106 |
echo '<td>'.format_size($tablestatus->Index_length).'</td>'."\n";; |
|---|
| 107 |
echo '<td>'.format_size($tablestatus->Data_free).'</td>'."\n"; |
|---|
| 108 |
$row_usage += $tablestatus->Rows; |
|---|
| 109 |
$data_usage += $tablestatus->Data_length; |
|---|
| 110 |
$index_usage += $tablestatus->Index_length; |
|---|
| 111 |
$overhead_usage += $tablestatus->Data_free; |
|---|
| 112 |
echo '</tr>'."\n"; |
|---|
| 113 |
} |
|---|
| 114 |
echo '<tr class="thead">'."\n"; |
|---|
| 115 |
echo '<th>'.__('Total:', 'wp-dbmanager').'</th>'."\n"; |
|---|
| 116 |
echo '<th>'.$no.' '.__('Tables', 'wp-dbmanager').'</th>'."\n"; |
|---|
| 117 |
echo '<th>'.number_format($row_usage).'</th>'."\n"; |
|---|
| 118 |
echo '<th>'.format_size($data_usage).'</th>'."\n"; |
|---|
| 119 |
echo '<th>'.format_size($index_usage).'</th>'."\n"; |
|---|
| 120 |
echo '<th>'.format_size($overhead_usage).'</th>'."\n"; |
|---|
| 121 |
echo '</tr>'; |
|---|
| 122 |
} else { |
|---|
| 123 |
echo '<tr><td colspan="6" align="center"><strong>'.__('Could Not Show Table Status Due To Your MYSQL Version Is Lower Than 3.23.', 'wp-dbmanager').'</strong></td></tr>'; |
|---|
| 124 |
} |
|---|
| 125 |
?> |
|---|
| 126 |
</table> |
|---|
| 127 |
</div> |
|---|