PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.3
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.3
4.7.0 4.6.1 4.6.0 4.5.5 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 All 111 releases
wp-optimize / templates / database / tables-body.php

tables-body.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.3, at templates/database/tables-body.php

118 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
2
3 <tbody id="the-list">
4 <?php
5
6 // Check for InnoDB tables.
7 // Check for windows servers.
8 $sqlversion = $wp_optimize->get_db_info()->get_version();
9 $tablesstatus = $wp_optimize->get_optimizer()->get_tables();
10 $is_multisite_mode = $wp_optimize->is_multisite_mode();
11 $total_gain = 0;
12 $no = 0;
13 $row_usage = 0;
14 $data_usage = 0;
15 $index_usage = 0;
16 $overhead_usage = 0;
17 $non_inno_db_tables = 0;
18 $inno_db_tables = 0;
19 $small_overhead_size = 1048576;
20
21 foreach ($tablesstatus as $tablestatus) {
22 $no++;
23 echo '<tr
24 data-tablename="'.esc_attr($tablestatus->Name).'"
25 data-type="'.esc_attr($tablestatus->Engine).'"
26 data-optimizable="'.($tablestatus->is_optimizable ? 1 : 0).'"
27 '.($is_multisite_mode ? 'data-blog_id="'.($tablestatus->blog_id).'"' : '').'
28 >'."\n";
29 echo '<td data-colname="'.__('No.', 'wp-optimize').'">'.number_format_i18n($no).'</td>'."\n";
30 echo '<td data-tablename="'.esc_attr($tablestatus->Name).'" data-colname="'.__('Table', 'wp-optimize').'">'.htmlspecialchars($tablestatus->Name);
31
32 if (!empty($tablestatus->plugin_status)) {
33 if ($tablestatus->wp_core_table) {
34 echo "<br><span style='font-size: 11px;'>".__('Belongs to:', 'wp-optimize')."</span> ";
35 echo "<span style='font-size: 11px;'>".__('WordPress core', 'wp-optimize')."</span>";
36 } else {
37 echo '<div class="table-plugins">';
38 echo "<span style='font-size: 11px;'>".__('Known plugins that use this table name:', 'wp-optimize')."</span> ";
39 $separator = '<br>';
40 foreach ($tablestatus->plugin_status as $plugins_status) {
41 $plugin = $plugins_status['plugin'];
42 $status = $plugins_status['status'];
43
44 echo $separator;
45
46 echo " <a href='https://wordpress.org/plugins/{$plugin}/' target='_blank'><span style='font-size: 11px;'>{$plugin}</a>";
47
48 if (false == $status['installed']) {
49 echo " <span style='font-size: 11px; color: #9B0000; font-weight: bold;'>[".__('not installed', 'wp-optimize')."]</span>";
50 } elseif (false == $status['active']) {
51 echo " <span style='font-size: 11px; color: #9B0000; font-weight: bold;'>[".__('inactive', 'wp-optimize')."]</span>";
52 }
53 }
54 echo '</div>';
55 }
56 }
57
58 echo "</td>\n";
59
60 echo '<td data-colname="'.__('Records', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Rows)).'">'.number_format_i18n($tablestatus->Rows).'</td>'."\n";
61 echo '<td data-colname="'.__('Data Size', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Data_length)).'">'.$wp_optimize->format_size($tablestatus->Data_length).'</td>'."\n";
62 echo '<td data-colname="'.__('Index Size', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Index_length)).'">'.$wp_optimize->format_size($tablestatus->Index_length).'</td>'."\n";
63
64 if ($tablestatus->is_optimizable) {
65 echo '<td data-colname="'.__('Type', 'wp-optimize').'" data-optimizable="1">'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";
66
67 echo '<td data-colname="'.__('Overhead', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Data_free)).'">';
68 $font_colour = ($optimize_db ? (($tablestatus->Data_free > $small_overhead_size) ? '#0000FF' : '#004600') : (($tablestatus->Data_free > $small_overhead_size) ? '#9B0000' : '#004600'));
69 echo '<span style="color:'.$font_colour.';">';
70 echo $wp_optimize->format_size($tablestatus->Data_free);
71 echo '</span>';
72 echo '</td>'."\n";
73
74 $overhead_usage += $tablestatus->Data_free;
75 $total_gain += $tablestatus->Data_free;
76 $non_inno_db_tables++;
77 } else {
78 echo '<td data-colname="'.__('Type', 'wp-optimize').'" data-optimizable="0">'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";
79 echo '<td data-colname="'.__('Overhead', 'wp-optimize').'">';
80 echo '<span style="color:#0000FF;">-</span>';
81 echo '</td>'."\n";
82
83 $inno_db_tables++;
84 }
85
86 echo '<td data-colname="'.__('Actions', 'wp-optimize').'">'.apply_filters('wpo_tables_list_additional_column_data', '', $tablestatus).'</td>';
87
88 $row_usage += $tablestatus->Rows;
89 $data_usage += $tablestatus->Data_length;
90 $index_usage += $tablestatus->Index_length;
91
92 echo '</tr>'."\n";
93 }
94
95 // THis extra tbody with class of tablesorter-no-sort
96 // Is for tablesorter and it will not allow the total bar
97 // At the bottom of the table information to be sorted with the rest of the data
98 echo '<tbody class="tablesorter-no-sort">'."\n";
99
100 echo '<tr class="thead">'."\n";
101 echo '<th>'.__('Total:', 'wp-optimize').'</th>'."\n";
102 echo '<th>'.sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), number_format_i18n($no)).'</th>'."\n";
103 echo '<th>'.number_format_i18n($row_usage).'</th>'."\n";
104 echo '<th>'.$wp_optimize->format_size($data_usage).'</th>'."\n";
105 echo '<th>'.$wp_optimize->format_size($index_usage).'</th>'."\n";
106 echo '<th>'.'-'.'</th>'."\n";
107 echo '<th>';
108
109 $font_colour = (($optimize_db) ? (($overhead_usage > $small_overhead_size) ? '#0000FF' : '#004600') : (($overhead_usage > $small_overhead_size) ? '#9B0000' : '#004600'));
110
111 echo '<span style="color:'.$font_colour.'">'.$wp_optimize->format_size($overhead_usage).'</span>';
112
113 ?>
114 </th>
115 <th><?php _e('Actions', 'wp-optimize'); ?></th>
116 </tr>
117 </tbody>
118