PluginProbe
WP-DBManager / 2.80.9
WP-DBManager v2.80.9
4.0.0 trunk 1.00 2.00 2.01 2.02 2.03 2.04 2.05 2.10 2.11 2.20 2.30 2.31 2.40 2.50 2.65 2.70 2.71 2.72 2.73 2.74 2.75 2.76 2.78 All 40 releases
wp-dbmanager / database-manager.php

database-manager.php in WP-DBManager 2.80.9, at database-manager.php

110 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 ### Check Whether User Can Manage Database
3 if ( ! current_user_can( 'install_plugins' ) ) {
4 die( 'Access Denied' );
5 }
6
7
8 ### Variables Variables Variables
9 $base_name = plugin_basename('wp-dbmanager/database-manager.php');
10 $base_page = 'admin.php?page='.$base_name;
11 $backup = array();
12 $backup_options = get_option('dbmanager_options');
13 $backup['date'] = current_time('timestamp');
14 $backup['mysqldumppath'] = $backup_options['mysqldumppath'];
15 $backup['mysqlpath'] = $backup_options['mysqlpath'];
16 $backup['path'] = $backup_options['path'];
17
18
19 ### Get MYSQL Version
20 $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
21 ?>
22 <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
23 <!-- Database Information -->
24 <div class="wrap">
25 <h2><?php _e('Database', 'wp-dbmanager'); ?></h2>
26 <h3><?php _e('Database Information', 'wp-dbmanager'); ?></h3>
27 <br style="clear" />
28 <table class="widefat">
29 <thead>
30 <tr>
31 <th><?php _e('Setting', 'wp-dbmanager'); ?></th>
32 <th><?php _e('Value', 'wp-dbmanager'); ?></th>
33 </tr>
34 </thead>
35 <tr>
36 <td><?php _e('Database Host', 'wp-dbmanager'); ?></td>
37 <td><?php echo DB_HOST; ?></td>
38 </tr>
39 <tr class="alternate">
40 <td><?php _e('Database Name', 'wp-dbmanager'); ?></td>
41 <td><?php echo DB_NAME; ?></td>
42 </tr>
43 <tr>
44 <td><?php _e('Database User', 'wp-dbmanager'); ?></td>
45 <td><?php echo DB_USER; ?></td>
46 </tr>
47 <tr class="alternate">
48 <td><?php _e('Database Type', 'wp-dbmanager'); ?></td>
49 <td>MYSQL</td>
50 </tr>
51 <tr>
52 <td><?php _e('Database Version', 'wp-dbmanager'); ?></td>
53 <td>v<?php echo $sqlversion; ?></td>
54 </tr>
55 </table>
56 </div>
57 <p>&nbsp;</p>
58
59 <div class="wrap">
60 <h3><?php _e('Tables Information', 'wp-dbmanager'); ?></h3>
61 <br style="clear" />
62 <table class="widefat">
63 <thead>
64 <tr>
65 <th><?php _e('No.', 'wp-dbmanager'); ?></th>
66 <th><?php _e('Tables', 'wp-dbmanager'); ?></th>
67 <th><?php _e('Records', 'wp-dbmanager'); ?></th>
68 <th><?php _e('Data Usage', 'wp-dbmanager'); ?></th>
69 <th><?php _e('Index Usage', 'wp-dbmanager'); ?></th>
70 <th><?php _e('Overhead', 'wp-dbmanager'); ?></th>
71 </tr>
72 </thead>
73 <?php
74 $no = 0;
75 $row_usage = 0;
76 $data_usage = 0;
77 $index_usage = 0;
78 $overhead_usage = 0;
79 $tablesstatus = $wpdb->get_results("SHOW TABLE STATUS");
80 foreach($tablesstatus as $tablestatus) {
81 if($no%2 == 0) {
82 $style = '';
83 } else {
84 $style = ' class="alternate"';
85 }
86 $no++;
87 echo "<tr$style>\n";
88 echo '<td>'.number_format_i18n($no).'</td>'."\n";
89 echo "<td>$tablestatus->Name</td>\n";
90 echo '<td>'.number_format_i18n($tablestatus->Rows).'</td>'."\n";
91 echo '<td>'.format_size($tablestatus->Data_length).'</td>'."\n";
92 echo '<td>'.format_size($tablestatus->Index_length).'</td>'."\n";;
93 echo '<td>'.format_size($tablestatus->Data_free).'</td>'."\n";
94 $row_usage += $tablestatus->Rows;
95 $data_usage += $tablestatus->Data_length;
96 $index_usage += $tablestatus->Index_length;
97 $overhead_usage += $tablestatus->Data_free;
98 echo '</tr>'."\n";
99 }
100 echo '<tr class="thead">'."\n";
101 echo '<th>'.__('Total:', 'wp-dbmanager').'</th>'."\n";
102 echo '<th>'.sprintf(_n('%s Table', '%s Tables', $no, 'wp-dbmanager'), number_format_i18n($no)).'</th>'."\n";
103 echo '<th>'.sprintf(_n('%s Record', '%s Records', $row_usage, 'wp-dbmanager'), number_format_i18n($row_usage)).'</th>'."\n";
104 echo '<th>'.format_size($data_usage).'</th>'."\n";
105 echo '<th>'.format_size($index_usage).'</th>'."\n";
106 echo '<th>'.format_size($overhead_usage).'</th>'."\n";
107 echo '</tr>';
108 ?>
109 </table>
110 </div>