PluginProbe ʕ •ᴥ•ʔ
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 1.8.9.8
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v1.8.9.8
4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 3.8.0 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 3.2.2 trunk 0.7.0 1.8.9.10 1.8.9.7 1.8.9.8 1.8.9.9 1.9 1.9.1 2.0.1 2.1.0 2.1.1 2.2.0 2.2.1 2.2.10 2.2.11 2.2.12 2.2.13 2.2.2 2.2.3 2.2.4 2.2.6 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.18 3.0.19 3.0.2 3.0.3 3.0.4 3.0.5 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.2 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19
wp-optimize / wp-optimize-tables.php
wp-optimize Last commit date
css 11 years ago languages 11 years ago LICENSE.txt 11 years ago elegantthemes_sm.png 12 years ago embedplus.png 11 years ago index.htm 12 years ago readme.txt 11 years ago screenshot-1.jpg 12 years ago screenshot-2.jpg 12 years ago screenshot-3.jpg 12 years ago screenshot-4.jpg 12 years ago screenshot-5.jpg 12 years ago translate.txt 11 years ago wp-optimize-admin.php 12 years ago wp-optimize-common.php 11 years ago wp-optimize-credits.php 11 years ago wp-optimize-main.php 11 years ago wp-optimize-settings.php 11 years ago wp-optimize-tables.php 11 years ago wp-optimize.php 11 years ago wp-optimize.png 11 years ago wpo.png 12 years ago
wp-optimize-tables.php
225 lines
1 <?php
2 # --------------------------------------- #
3 # prevent file from being accessed directly
4 # --------------------------------------- #
5 if ( ! defined( 'WPINC' ) ) {
6 die;
7 }
8
9 if (isset($_POST["optimize-db"])) {
10 optimizeTables(true);
11 }
12 else optimizeTables(false);
13
14 ?>
15 <?php
16 Function optimizeTables($Optimize=false){
17 ?>
18 <h3>
19 <?php
20 _e('Database Name:', 'wp-optimize'); ?> '<?php _e(DB_NAME, 'wp-optimize');
21 echo "'";
22 ?></h3>
23
24
25 <?php if($Optimize){
26 ?>
27
28 <p><?php _e('Optimized all the tables found in the database.', 'wp-optimize')?></p>
29 <?php } ?>
30
31
32 <br style="clear" />
33 <table class="widefat">
34 <thead>
35 <tr>
36 <th><?php _e('No.', 'wp-optimize'); ?></th>
37 <th><?php _e('Tables', 'wp-optimize'); ?></th>
38 <th><?php _e('Records', 'wp-optimize'); ?></th>
39 <th><?php _e('Data Size', 'wp-optimize'); ?></th>
40 <th><?php _e('Index Size', 'wp-optimize'); ?></th>
41 <th><?php _e('Type', 'wp-optimize'); ?></th>
42 <th><?php _e('Overhead', 'wp-optimize');?></th>
43
44 </tr>
45 </thead>
46
47 <tbody id="the-list">
48 <?php
49 $alternate = ' class="alternate"';
50 global $wpdb;
51 // Read SQL Version and act accordingly
52 // Check for InnoDB tables
53 // Check for windows servers
54 $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
55 $total_gain = 0;
56 $no = 0;
57 $row_usage = 0;
58 $data_usage = 0;
59 $index_usage = 0;
60 $overhead_usage = 0;
61 $tablesstatus = $wpdb->get_results("SHOW TABLE STATUS");
62 foreach($tablesstatus as $tablestatus) {
63 if($no%2 == 0) {
64 $style = '';
65 } else {
66 $style = ' class="alternate"';
67 }
68 $no++;
69 echo "<tr$style>\n";
70 echo '<td>'.number_format_i18n($no).'</td>'."\n";
71 echo "<td>$tablestatus->Name</td>\n";
72 echo '<td>'.number_format_i18n($tablestatus->Rows).'</td>'."\n";
73 echo '<td>'.wpo_format_size($tablestatus->Data_length).'</td>'."\n";
74 echo '<td>'.wpo_format_size($tablestatus->Index_length).'</td>'."\n";;
75 echo '<td>'.$tablestatus->Engine.'</td>'."\n";;
76 //echo '<td>'.wpo_format_size($tablestatus->Data_free).'</td>'."\n";
77
78 if ($tablestatus->Engine != 'InnoDB'){
79
80 echo '<td>';
81 if (isset($_POST["optimize-db"])) {
82
83 if($tablestatus->Data_free>0){
84 echo '<font color="blue">';
85 echo wpo_format_size($tablestatus->Data_free);
86 echo '</font>';
87 }
88 else {
89 echo '<font color="green">';
90 echo wpo_format_size($tablestatus->Data_free);
91 echo '</font>';
92 }
93 }
94 else {
95 if($tablestatus->Data_free>0){
96 echo '<font color="red">';
97 echo wpo_format_size($tablestatus->Data_free);
98 echo '</font>';
99 }
100 else {
101 echo '<font color="green">';
102 echo wpo_format_size($tablestatus->Data_free);
103 echo '</font>';
104 }
105 }
106
107 echo '</td>'."\n";
108 }
109 else {
110 echo '<td>';
111
112 echo '<font color="blue">';
113 echo '-';
114 echo '</font>';
115
116
117 echo '</td>'."\n";
118
119 }
120
121 $row_usage += $tablestatus->Rows;
122 $data_usage += $tablestatus->Data_length;
123 $index_usage += $tablestatus->Index_length;
124
125 if ($tablestatus->Engine != 'InnoDB'){
126 $overhead_usage += $tablestatus->Data_free;
127 $total_gain += $tablestatus->Data_free;
128 } else {
129 $overhead_usage += 0;
130 $total_gain += 0;
131 }
132 echo '</tr>'."\n";
133 }
134
135
136 echo '<tr class="thead">'."\n";
137 echo '<th>'.__('Total:', 'wp-optimize').'</th>'."\n";
138 echo '<th>'.sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), number_format_i18n($no)).'</th>'."\n";
139 echo '<th>'.sprintf(_n('%s Record', '%s Records', $row_usage, 'wp-optimize'), number_format_i18n($row_usage)).'</th>'."\n";
140 echo '<th>'.wpo_format_size($data_usage).'</th>'."\n";
141 echo '<th>'.wpo_format_size($index_usage).'</th>'."\n";
142 echo '<th>'.'-'.'</th>'."\n";
143 echo '<th>';
144
145
146 if (isset($_POST["optimize-db"])) {
147
148
149 if($overhead_usage>0){
150 echo '<font color="blue">';
151 echo wpo_format_size($overhead_usage);
152 echo '</font>';
153 }
154 else {
155 echo '<font color="green">';
156 echo wpo_format_size($overhead_usage);
157 echo '</font>';
158 }
159 }
160 else {
161 if($overhead_usage>0){
162 echo '<font color="red">';
163 echo wpo_format_size($overhead_usage);
164 echo '</font>';
165 }
166 else {
167 echo '<font color="green">';
168 echo wpo_format_size($overhead_usage);
169 echo '</font>';
170 }
171 }
172 echo '</th>'."\n";
173 echo '</tr>';
174
175 ?>
176 </tbody>
177 </table>
178
179 <h3><?php _e('Total Size of Database', 'wp-optimize'); ?>:</h3>
180 <h2><?php
181 list ($part1, $part2) = wpo_getCurrentDBSize();
182 echo $part1;
183
184 ?></h2>
185
186 <?php if (isset($_POST["optimize-db"])) {
187 ?>
188
189 <?php //$total_gain = round ($total_gain,3);?>
190
191 <h3><?php _e('Optimization Results', 'wp-optimize'); ?>:</h3>
192 <p style="color: #0000FF;">
193 <?php
194
195 if ($total_gain > 0){
196 _e('Total Space Saved', 'wp-optimize');
197 echo ': ';
198 echo wpo_format_size($total_gain); wpo_updateTotalCleaned(strval($total_gain));
199 }
200 ?></p>
201 <?php } else { ?>
202 <?php //$total_gain = round ($total_gain,3); ?>
203 <?php if(!$total_gain==0){ ?>
204
205 <h3><?php
206
207 if ($total_gain > 0){
208 _e('Optimization Possibility', 'wp-optimize');
209 echo ':';
210 }
211
212 ?></h3>
213 <p style="color: #FF0000;">
214 <?php if ($total_gain > 0){
215 _e('Total space can be saved', 'wp-optimize'); ?>: <?php echo wpo_format_size($total_gain);
216 }
217 ?></p>
218 <?php } ?>
219 <?php
220 }
221 ?>
222
223 <?php
224 } //end of optimize function
225 ?>