Skip to content

Commit b581d8f

Browse files
Database Summary - Update Autoload Table (#733)
* Update Database Summary Autoload Table * Add autoload type to table in admin * Review changes --------- Co-authored-by: Timotei <[email protected]>
1 parent f68351e commit b581d8f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/db-optm.cls.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,15 @@ public function autoload_summary()
309309
{
310310
global $wpdb;
311311

312-
$summary = $wpdb->get_row("SELECT SUM(LENGTH(option_value)) AS autoload_size,COUNT(*) AS autload_entries FROM `$wpdb->options` WHERE autoload='yes'");
312+
$autoloads = function_exists('wp_autoload_values_to_autoload') ? wp_autoload_values_to_autoload() : array('yes', 'on', 'auto-on', 'auto');
313+
$autoloads = '("' . implode('","', $autoloads) . '")';
314+
315+
$summary = $wpdb->get_row("SELECT SUM(LENGTH(option_value)) AS autoload_size,COUNT(*) AS autload_entries FROM `$wpdb->options` WHERE autoload IN " . $autoloads);
313316

314317
$summary->autoload_toplist = $wpdb->get_results(
315-
"SELECT option_name, LENGTH(option_value) AS option_value_length FROM `$wpdb->options` WHERE autoload='yes' ORDER BY option_value_length DESC LIMIT 20"
318+
"SELECT option_name, LENGTH(option_value) AS option_value_length, autoload FROM `$wpdb->options` WHERE autoload IN " .
319+
$autoloads .
320+
' ORDER BY option_value_length DESC LIMIT 20'
316321
);
317322

318323
return $summary;

tpl/db_optm/manage.tpl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
<tr>
175175
<th scope="col">#</th>
176176
<th scope="col"><?php echo __('Option Name', 'litespeed-cache'); ?></th>
177+
<th scope="col"><?php echo __('Autoload', 'litespeed-cache'); ?></th>
177178
<th scope="col"><?php echo __('Size', 'litespeed-cache'); ?></th>
178179
</tr>
179180
</thead>
@@ -182,6 +183,7 @@
182183
<tr>
183184
<td><?php echo $k + 1; ?></td>
184185
<td><?php echo $v->option_name; ?></td>
186+
<td><?php echo $v->autoload; ?></td>
185187
<td><?php echo $v->option_value_length; ?></td>
186188
</tr>
187189
<?php endforeach; ?>

0 commit comments

Comments
 (0)