initial commit
This commit is contained in:
@ -0,0 +1,89 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<table id="optimizations_list" class="wp-list-table widefat striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="check-column"><input id="select_all_optimizations" type="checkbox" /></td>
|
||||
<th><?php _e('Optimization', 'wp-optimize'); ?></th>
|
||||
<th></th>
|
||||
<!-- <th></th>-->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$optimizations = $optimizer->sort_optimizations($optimizer->get_optimizations());
|
||||
|
||||
foreach ($optimizations as $id => $optimization) {
|
||||
if ('optimizetables' == $id && false === $does_server_allows_table_optimization) continue;
|
||||
// If we don't want to show optimization on the first tab.
|
||||
if (false === $optimization->display_in_optimizations_list()) continue;
|
||||
// This is an array, with attributes dom_id, activated, settings_label, info; all values are strings.
|
||||
$use_ajax = defined('WP_OPTIMIZE_DEBUG_OPTIMIZATIONS') && WP_OPTIMIZE_DEBUG_OPTIMIZATIONS ? false : true;
|
||||
$html = $optimization->get_settings_html($use_ajax);
|
||||
|
||||
$optimize_table_list_disabled = '';
|
||||
$optimize_table_list_data_disabled = '';
|
||||
|
||||
// Check if the DOM is optimize-db to generate a list of tables.
|
||||
if ('optimize-db' == $html['dom_id']) {
|
||||
$table_list = $optimizer->get_table_information();
|
||||
|
||||
// Make sure that optimization_table_inno_db is set.
|
||||
if ($table_list['inno_db_tables'] > 0 && 0 == $table_list['is_optimizable'] && 0 == $table_list['non_inno_db_tables']) {
|
||||
$optimize_table_list_disabled .= 'disabled';
|
||||
$optimize_table_list_data_disabled = 'data-disabled="1"';
|
||||
$html['activated'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$sensitive_items = array(
|
||||
'clean-transient',
|
||||
'clean-pingbacks',
|
||||
'clean-trackbacks',
|
||||
'clean-postmeta',
|
||||
'clean-orphandata',
|
||||
'clean-commentmeta',
|
||||
);
|
||||
|
||||
?>
|
||||
<tr class="wp-optimize-settings wp-optimize-settings-<?php echo $html['dom_id']; ?><?php echo (in_array($html['dom_id'], $sensitive_items)) ? ' wp-optimize-setting-is-sensitive' : ''; ?>" id="wp-optimize-settings-<?php echo $html['dom_id']; ?>" data-optimization_id="<?php echo esc_attr($id); ?>" data-optimization_run_sort_order="<?php echo $optimization->get_run_sort_order(); ?>" >
|
||||
<?php
|
||||
if (!empty($html['settings_label'])) {
|
||||
?>
|
||||
|
||||
<th class="wp-optimize-settings-optimization-checkbox check-column">
|
||||
<input name="<?php echo $html['dom_id']; ?>" id="optimization_checkbox_<?php echo $id; ?>" class="optimization_checkbox" type="checkbox" value="true" <?php if ($html['activated']) echo 'checked="checked"'; ?> <?php echo $optimize_table_list_data_disabled; ?> <?php echo $optimize_table_list_disabled; ?> >
|
||||
|
||||
<img id="optimization_spinner_<?php echo $id; ?>" class="optimization_spinner display-none" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
|
||||
</th>
|
||||
|
||||
|
||||
<td>
|
||||
<label for="optimization_checkbox_<?php echo $id; ?>"><?php echo $html['settings_label']; ?></label>
|
||||
<div class="wp-optimize-settings-optimization-info" id="optimization_info_<?php echo $id; ?>">
|
||||
<?php
|
||||
if ($use_ajax && array_key_exists('support_ajax_get_info', $html) && $html['support_ajax_get_info']) {
|
||||
$last_output = $optimization->get_last_output();
|
||||
if ($last_output) {
|
||||
echo join('<br>', $last_output);
|
||||
} else {
|
||||
echo '<span class="wp-optimize-optimization-info-ajax" data-id="'.$id.'">...</span>';
|
||||
}
|
||||
} else {
|
||||
echo join('<br>', $html['info']);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="wp-optimize-settings-optimization-run">
|
||||
<button id="optimization_button_<?php echo $id; ?>_big" class="button button-secondary wp-optimize-settings-optimization-run-button show_on_default_sizes optimization_button_<?php echo $id; ?>" type="button" <?php echo $optimize_table_list_data_disabled; ?> <?php echo $optimize_table_list_disabled; ?> ><?php _e('Run optimization', 'wp-optimize'); ?></button>
|
||||
|
||||
<button id="optimization_button_<?php echo $id; ?>_small" class="button button-secondary wp-optimize-settings-optimization-run-button show_on_mobile_sizes optimization_button_<?php echo $id; ?>" type="button" <?php echo $optimize_table_list_data_disabled; ?> <?php echo $optimize_table_list_disabled; ?> ><?php _e('Go', 'wp-optimize'); ?></button>
|
||||
</td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
if (!defined('WPO_VERSION')) die('No direct access allowed');
|
||||
|
||||
?>
|
||||
<div class="wpo_shade hidden">
|
||||
<div class="wpo_shade_inner">
|
||||
<span class="dashicons dashicons-update-alt wpo-rotate"></span>
|
||||
<h4><?php _e('Loading data...', 'wp-optimize'); ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wpo_section wpo_group">
|
||||
|
||||
<?php
|
||||
if (!empty($optimization_results)) {
|
||||
echo '<div id="message" class="updated below-h2"><strong>';
|
||||
foreach ($optimization_results as $optimization_result) {
|
||||
if (!empty($optimization_result->output)) {
|
||||
foreach ($optimization_result->output as $line) {
|
||||
echo $line."<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</strong></div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php WP_Optimize()->include_template('database/status-box-contents.php', false, array('optimize_db' => false)); ?>
|
||||
|
||||
<form onsubmit="return confirm('<?php echo esc_js(__('Warning: This operation is permanent. Continue?', 'wp-optimize')); ?>')" action="#" method="post" enctype="multipart/form-data" name="optimize_form" id="optimize_form">
|
||||
|
||||
<?php wp_nonce_field('wpo_optimization'); ?>
|
||||
|
||||
<h3><?php _e('Optimizations', 'wp-optimize'); ?></h3>
|
||||
|
||||
|
||||
<div class="wpo-run-optimizations__container">
|
||||
<?php $button_caption = apply_filters('wpo_run_button_caption', __('Run all selected optimizations', 'wp-optimize')); ?>
|
||||
<input class="button button-primary button-large" type="submit" id="wp-optimize" name="wp-optimize" value="<?php echo esc_attr($button_caption); ?>" /><?php WP_Optimize()->include_template('take-a-backup.php', false, array('checkbox_name' => 'enable-auto-backup')); ?>
|
||||
</div>
|
||||
|
||||
<?php do_action('wpo_additional_options'); ?>
|
||||
|
||||
<?php
|
||||
if ($load_data) {
|
||||
WP_Optimize()->include_template('database/optimizations-table.php', false, array('does_server_allows_table_optimization' => $does_server_allows_table_optimization));
|
||||
} else {
|
||||
?>
|
||||
<div class="wp-optimize-optimizations-table-placeholder">
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<p class="wp-optimize-sensitive-tables-warning">
|
||||
<span style="color: #E07575;"><span class="dashicons dashicons-warning"></span> <?php echo __('Warning:', 'wp-optimize').'</span> '.__('Items marked with this icon perform more intensive database operations. In very rare cases, if your database server happened to crash or be forcibly powered down at the same time as an optimization operation was running, data might be corrupted. ', 'wp-optimize').' '.__('You may wish to run a backup before optimizing.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,84 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<h3><?php _e('Scheduled clean-up settings', 'wp-optimize'); ?></h3>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo WP_Optimize()->premium_version_link; ?>" target="_blank"><?php _e('Take control of clean-ups: Upgrade to Premium for a more powerful and flexible scheduler', 'wp-optimize'); ?></a>
|
||||
</p>
|
||||
|
||||
<div class="wpo-fieldgroup">
|
||||
|
||||
<p>
|
||||
|
||||
<input name="enable-schedule" id="enable-schedule" type="checkbox" value ="true" <?php checked($options->get_option('schedule'), 'true'); ?>>
|
||||
<label for="enable-schedule"><?php _e('Enable scheduled clean-up and optimization', 'wp-optimize'); ?></label>
|
||||
|
||||
</p>
|
||||
|
||||
<div id="wp-optimize-auto-options">
|
||||
|
||||
<p>
|
||||
|
||||
<?php _e('Select schedule type (default is Weekly)', 'wp-optimize'); ?><br>
|
||||
<select id="schedule_type" name="schedule_type">
|
||||
|
||||
<?php
|
||||
$schedule_options = array(
|
||||
'wpo_daily' => __('Daily', 'wp-optimize'),
|
||||
'wpo_weekly' => __('Weekly', 'wp-optimize'),
|
||||
'wpo_fortnightly' => __('Fortnightly', 'wp-optimize'),
|
||||
'wpo_monthly' => __('Monthly (approx. - every 30 days)', 'wp-optimize'),
|
||||
);
|
||||
|
||||
$schedule_type_saved_id = $options->get_option('schedule-type', 'wpo_weekly');
|
||||
|
||||
// Backwards compatibility:
|
||||
if ('wpo_otherweekly' == $schedule_type_saved_id) $schedule_type_saved_id = 'wpo_fortnightly';
|
||||
|
||||
foreach ($schedule_options as $opt_id => $opt_description) {
|
||||
?>
|
||||
<option value="<?php echo esc_attr($opt_id); ?>" <?php if ($opt_id == $schedule_type_saved_id) echo 'selected="selected"'; ?>><?php echo htmlspecialchars($opt_description); ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
|
||||
</p>
|
||||
|
||||
<?php
|
||||
$wpo_auto_options = $options->get_option('auto');
|
||||
|
||||
$optimizations = $optimizer->sort_optimizations($optimizer->get_optimizations());
|
||||
|
||||
foreach ($optimizations as $id => $optimization) {
|
||||
if (empty($optimization->available_for_auto)) continue;
|
||||
|
||||
$auto_id = $optimization->get_auto_id();
|
||||
|
||||
$auto_dom_id = 'wp-optimize-auto-'.$auto_id;
|
||||
|
||||
$setting_activated = (empty($wpo_auto_options[$auto_id]) || 'false' == $wpo_auto_options[$auto_id]) ? false : true;
|
||||
?>
|
||||
<p>
|
||||
<input name="wp-optimize-auto[<?php echo $auto_id; ?>]" id="<?php echo esc_attr($auto_dom_id); ?>" type="checkbox" value="true" <?php if ($setting_activated) echo 'checked="checked"'; ?>> <label for="<?php echo esc_attr($auto_dom_id); ?>"><?php echo $optimization->get_auto_option_description(); ?></label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- disabled email notification
|
||||
<p>
|
||||
<label>
|
||||
<input name="enable-email" id="enable-email" type="checkbox" value ="true" />
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="enable-email-address">
|
||||
<input name="enable-email-address" id="enable-email-address" type="text" value ="" />
|
||||
</label>
|
||||
</p> -->
|
||||
|
||||
</div><!-- END #wp-optimize-auto-options -->
|
||||
</div><!-- END .wpo-fieldgroup -->
|
@ -0,0 +1,39 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<h3 class="wpo-first-child"><?php _e('General settings', 'wp-optimize'); ?></h3>
|
||||
<div class="wpo-fieldgroup">
|
||||
<p>
|
||||
<?php _e('Whether manually or on a schedule, these settings apply whenever a relevant optimization is run.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
<p>
|
||||
<input name="enable-retention" id="enable-retention" type="checkbox" value ="true" <?php echo ($options->get_option('retention-enabled') == 'true') ? 'checked="checked"' : ''; ?> />
|
||||
<?php
|
||||
$retention_period = max((int) $options->get_option('retention-period', '2'), 1);
|
||||
|
||||
echo '<label for="enable-retention">';
|
||||
printf(
|
||||
__('Keep last %s weeks data', 'wp-optimize'),
|
||||
'</label><input id="retention-period" name="retention-period" type="number" step="1" min="2" max="99" value="'.$retention_period.'"><label for="enable-retention">'
|
||||
);
|
||||
echo '</label>';
|
||||
?>
|
||||
<br>
|
||||
<small><?php _e('This option will, where relevant, retain data from the chosen period, and remove any garbage data before that period.', 'wp-optimize').' '.__('If the option is not active, then all garbage data will be removed.', 'wp-optimize').' '.__('This will also affect Auto Clean-up process', 'wp-optimize'); ?></small>
|
||||
</p>
|
||||
<p>
|
||||
<input name="enable-revisions-retention" id="enable-revisions-retention" type="checkbox" value ="true" <?php echo ('true' == $options->get_option('revisions-retention-enabled')) ? 'checked="checked"' : ''; ?> />
|
||||
<?php
|
||||
$revisions_retention_count = (int) $options->get_option('revisions-retention-count', '2');
|
||||
|
||||
echo '<label for="enable-revisions-retention">';
|
||||
printf(
|
||||
__('Always keep %s post revisions', 'wp-optimize'),
|
||||
'</label><input id="revisions-retention-count" name="revisions-retention-count" type="number" step="1" min="2" max="99" value="'.$revisions_retention_count.'"><label for="revisions-retention-count">'
|
||||
);
|
||||
echo '</label>';
|
||||
?>
|
||||
<br>
|
||||
<small><?php _e('This option will retain specified number of post revisions, and remove other revisions.', 'wp-optimize').' '.__('If the option is not active, then all garbage data will be removed.', 'wp-optimize').' '.__('This will also affect Auto Clean-up process', 'wp-optimize'); ?></small>
|
||||
</p>
|
||||
<?php WP_Optimize()->include_template('take-a-backup.php', false, array('label' => __('Take a backup with UpdraftPlus before running scheduled optimizations', 'wp-optimize'), 'checkbox_name' => 'enable-auto-backup-scheduled')); ?>
|
||||
</div>
|
@ -0,0 +1,26 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<div id="wp-optimize-database-settings" class="wpo_section wpo_group">
|
||||
<form action="#" method="post" enctype="multipart/form-data" name="database_settings_form" id="database_settings_form">
|
||||
<div id="wpo_database_settings_warnings"></div>
|
||||
<?php
|
||||
WP_Optimize()->include_template('database/settings-general.php');
|
||||
WP_Optimize()->include_template('database/settings-auto-cleanup.php', false, array('show_innodb_option' => false));
|
||||
?>
|
||||
|
||||
<div id="wp-optimize-save-database-settings-results"></div>
|
||||
|
||||
<input type="hidden" name="action" value="save_redirect">
|
||||
|
||||
<?php wp_nonce_field('wpo_optimization', '_wpnonce_db_settings'); ?>
|
||||
|
||||
<div class="wp-optimize-settings-save-results"></div>
|
||||
|
||||
<input id="wp-optimize-save-database-settings" class="button button-primary wpo-save-settings" type="submit" name="wp-optimize-settings" value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>" />
|
||||
|
||||
<img class="wpo_spinner wpo-saving-settings" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
|
||||
|
||||
<span class="dashicons dashicons-yes display-none save-done"></span>
|
||||
|
||||
</form>
|
||||
</div><!-- end #wp-optimize-general-settings -->
|
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
if (!defined('WPO_VERSION')) die('No direct access allowed');
|
||||
|
||||
$retention_enabled = $options->get_option('retention-enabled', 'false');
|
||||
$retention_period = $options->get_option('retention-period', '2');
|
||||
$admin_page_url = $options->admin_page_url();
|
||||
|
||||
$revisions_retention_enabled = $options->get_option('revisions-retention-enabled', 'false');
|
||||
$revisions_retention_count = $options->get_option('revisions-retention-count', '2');
|
||||
|
||||
?>
|
||||
|
||||
<h3 class="wpo-first-child"><?php _e('Status', 'wp-optimize'); ?></h3>
|
||||
|
||||
<div class="wpo-fieldgroup" id="wp_optimize_status_box">
|
||||
<p>
|
||||
<?php
|
||||
$lastopt = $options->get_option('last-optimized', 'Never');
|
||||
if ('Never' !== $lastopt) {
|
||||
// check if last optimized value is integer.
|
||||
if (is_numeric($lastopt)) {
|
||||
$lastopt = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $lastopt + ( get_option('gmt_offset') * HOUR_IN_SECONDS ));
|
||||
}
|
||||
echo __('Last scheduled optimization was at', 'wp-optimize').': ';
|
||||
echo '<span style="font-color: #004600; font-weight:bold;">';
|
||||
echo htmlspecialchars($lastopt);
|
||||
echo '</span>';
|
||||
} else {
|
||||
echo __('There was no scheduled optimization', 'wp-optimize');
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
|
||||
$scheduled_optimizations_enabled = false;
|
||||
|
||||
if (WP_Optimize::is_premium()) {
|
||||
$scheduled_optimizations = WP_Optimize_Premium()->get_scheduled_optimizations();
|
||||
|
||||
if (!empty($scheduled_optimizations)) {
|
||||
foreach ($scheduled_optimizations as $optimization) {
|
||||
if (isset($optimization['status']) && 1 == $optimization['status']) {
|
||||
$scheduled_optimizations_enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$scheduled_optimizations_enabled = $options->get_option('schedule', 'false') == 'true';
|
||||
}
|
||||
|
||||
if ($scheduled_optimizations_enabled) {
|
||||
echo '<strong>';
|
||||
_e('Scheduled cleaning', 'wp-optimize');
|
||||
echo ' <span style="color: #009B24;">'.__('enabled', 'wp-optimize').'</span>';
|
||||
echo ', </strong>';
|
||||
|
||||
$timestamp = apply_filters('wpo_cron_next_event', wp_next_scheduled('wpo_cron_event2'));
|
||||
|
||||
if ($timestamp) {
|
||||
|
||||
$timestamp = $timestamp + 60 * 60 * get_option('gmt_offset');
|
||||
|
||||
$wp_optimize->cron_activate();
|
||||
|
||||
$date = new DateTime("@".$timestamp);
|
||||
_e('Next schedule:', 'wp-optimize');
|
||||
echo ' ';
|
||||
echo '<span style="font-color: #004600">';
|
||||
echo gmdate(get_option('date_format') . ' ' . get_option('time_format'), $timestamp);
|
||||
echo '</span>';
|
||||
echo ' - <a id="wp_optimize_status_box_refresh" href="'.esc_attr($admin_page_url).'">'.__('Refresh', 'wp-optimize').'</a>';
|
||||
}
|
||||
} else {
|
||||
echo '<strong>';
|
||||
_e('Scheduled cleaning disabled', 'wp-optimize');
|
||||
echo '</strong>';
|
||||
}
|
||||
echo '<br>';
|
||||
|
||||
if ('true' == $retention_enabled) {
|
||||
echo '<strong><span style="font-color: #0000FF;">';
|
||||
printf(__('Keeping last %s weeks data', 'wp-optimize'), $retention_period);
|
||||
echo '</span></strong>';
|
||||
} else {
|
||||
echo '<strong>'.__('Not keeping recent data', 'wp-optimize').'</strong>';
|
||||
}
|
||||
|
||||
echo '<br>';
|
||||
|
||||
if ('true' == $revisions_retention_enabled) {
|
||||
echo '<strong><span style="font-color: #0000FF;">';
|
||||
printf(__('Keeping last %s revisions', 'wp-optimize'), $revisions_retention_count);
|
||||
echo '</span></strong>';
|
||||
} else {
|
||||
echo '<strong>'.__('Not keeping any revisions', 'wp-optimize').'</strong>';
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
$total_cleaned = $options->get_option('total-cleaned');
|
||||
$total_cleaned_num = floatval($total_cleaned);
|
||||
|
||||
if ($total_cleaned_num > 0) {
|
||||
echo '<h5>'.__('Total clean up overall:', 'wp-optimize').' ';
|
||||
echo '<span style="font-color: #004600">';
|
||||
echo $wp_optimize->format_size($total_cleaned);
|
||||
echo '</span></h5>';
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
$corrupted_tables_count = $options->get_option('corrupted-tables-count', 0);
|
||||
|
||||
if ($corrupted_tables_count > 0) {
|
||||
?>
|
||||
<p>
|
||||
<span style="color: #E07575;"><?php printf(_n('Your database has %s corrupted table.', 'Your database has %s corrupted tables.', $corrupted_tables_count, 'wp-optimize'), $corrupted_tables_count); ?></span><br>
|
||||
<a href="<?php echo esc_attr($admin_page_url); ?>&tab=wp_optimize_tables" onclick="jQuery('.wpo-pages-menu > a').first().trigger('click'); jQuery('#wp-optimize-nav-tab-wpo_database-tables').trigger('click'); return false;"><?php _e('Repair corrupted tables here.', 'wp-optimize'); ?></a>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</div>
|
@ -0,0 +1,117 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
|
||||
// Check for InnoDB tables.
|
||||
// Check for windows servers.
|
||||
$sqlversion = $wp_optimize->get_db_info()->get_version();
|
||||
$tablesstatus = $wp_optimize->get_optimizer()->get_tables();
|
||||
$is_multisite_mode = $wp_optimize->is_multisite_mode();
|
||||
$total_gain = 0;
|
||||
$no = 0;
|
||||
$row_usage = 0;
|
||||
$data_usage = 0;
|
||||
$index_usage = 0;
|
||||
$overhead_usage = 0;
|
||||
$non_inno_db_tables = 0;
|
||||
$inno_db_tables = 0;
|
||||
$small_overhead_size = 1048576;
|
||||
|
||||
foreach ($tablesstatus as $tablestatus) {
|
||||
$no++;
|
||||
echo '<tr
|
||||
data-tablename="'.esc_attr($tablestatus->Name).'"
|
||||
data-type="'.esc_attr($tablestatus->Engine).'"
|
||||
data-optimizable="'.($tablestatus->is_optimizable ? 1 : 0).'"
|
||||
'.($is_multisite_mode ? 'data-blog_id="'.($tablestatus->blog_id).'"' : '').'
|
||||
>'."\n";
|
||||
echo '<td data-colname="'.__('No.', 'wp-optimize').'">'.number_format_i18n($no).'</td>'."\n";
|
||||
echo '<td data-tablename="'.esc_attr($tablestatus->Name).'" data-colname="'.__('Table', 'wp-optimize').'">'.htmlspecialchars($tablestatus->Name);
|
||||
|
||||
if (!empty($tablestatus->plugin_status)) {
|
||||
if ($tablestatus->wp_core_table) {
|
||||
echo "<br><span style='font-size: 11px;'>".__('Belongs to:', 'wp-optimize')."</span> ";
|
||||
echo "<span style='font-size: 11px;'>".__('WordPress core', 'wp-optimize')."</span>";
|
||||
} else {
|
||||
echo '<div class="table-plugins">';
|
||||
echo "<span style='font-size: 11px;'>".__('Known plugins that use this table name:', 'wp-optimize')."</span> ";
|
||||
$separator = '<br>';
|
||||
foreach ($tablestatus->plugin_status as $plugins_status) {
|
||||
$plugin = $plugins_status['plugin'];
|
||||
$status = $plugins_status['status'];
|
||||
|
||||
echo $separator;
|
||||
|
||||
echo " <a href='https://wordpress.org/plugins/{$plugin}/' target='_blank'><span style='font-size: 11px;'>{$plugin}</a>";
|
||||
|
||||
if (false == $status['installed']) {
|
||||
echo " <span style='font-size: 11px; color: #9B0000; font-weight: bold;'>[".__('not installed', 'wp-optimize')."]</span>";
|
||||
} elseif (false == $status['active']) {
|
||||
echo " <span style='font-size: 11px; color: #9B0000; font-weight: bold;'>[".__('inactive', 'wp-optimize')."]</span>";
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
echo "</td>\n";
|
||||
|
||||
echo '<td data-colname="'.__('Records', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Rows)).'">'.number_format_i18n($tablestatus->Rows).'</td>'."\n";
|
||||
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";
|
||||
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";
|
||||
|
||||
if ($tablestatus->is_optimizable) {
|
||||
echo '<td data-colname="'.__('Type', 'wp-optimize').'" data-optimizable="1">'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";
|
||||
|
||||
echo '<td data-colname="'.__('Overhead', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Data_free)).'">';
|
||||
$font_colour = ($optimize_db ? (($tablestatus->Data_free > $small_overhead_size) ? '#0000FF' : '#004600') : (($tablestatus->Data_free > $small_overhead_size) ? '#9B0000' : '#004600'));
|
||||
echo '<span style="color:'.$font_colour.';">';
|
||||
echo $wp_optimize->format_size($tablestatus->Data_free);
|
||||
echo '</span>';
|
||||
echo '</td>'."\n";
|
||||
|
||||
$overhead_usage += $tablestatus->Data_free;
|
||||
$total_gain += $tablestatus->Data_free;
|
||||
$non_inno_db_tables++;
|
||||
} else {
|
||||
echo '<td data-colname="'.__('Type', 'wp-optimize').'" data-optimizable="0">'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";
|
||||
echo '<td data-colname="'.__('Overhead', 'wp-optimize').'">';
|
||||
echo '<span style="color:#0000FF;">-</span>';
|
||||
echo '</td>'."\n";
|
||||
|
||||
$inno_db_tables++;
|
||||
}
|
||||
|
||||
echo '<td data-colname="'.__('Actions', 'wp-optimize').'">'.apply_filters('wpo_tables_list_additional_column_data', '', $tablestatus).'</td>';
|
||||
|
||||
$row_usage += $tablestatus->Rows;
|
||||
$data_usage += $tablestatus->Data_length;
|
||||
$index_usage += $tablestatus->Index_length;
|
||||
|
||||
echo '</tr>'."\n";
|
||||
}
|
||||
|
||||
// THis extra tbody with class of tablesorter-no-sort
|
||||
// Is for tablesorter and it will not allow the total bar
|
||||
// At the bottom of the table information to be sorted with the rest of the data
|
||||
echo '<tbody class="tablesorter-no-sort">'."\n";
|
||||
|
||||
echo '<tr class="thead">'."\n";
|
||||
echo '<th>'.__('Total:', 'wp-optimize').'</th>'."\n";
|
||||
echo '<th>'.sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), number_format_i18n($no)).'</th>'."\n";
|
||||
echo '<th>'.number_format_i18n($row_usage).'</th>'."\n";
|
||||
echo '<th>'.$wp_optimize->format_size($data_usage).'</th>'."\n";
|
||||
echo '<th>'.$wp_optimize->format_size($index_usage).'</th>'."\n";
|
||||
echo '<th>'.'-'.'</th>'."\n";
|
||||
echo '<th>';
|
||||
|
||||
$font_colour = (($optimize_db) ? (($overhead_usage > $small_overhead_size) ? '#0000FF' : '#004600') : (($overhead_usage > $small_overhead_size) ? '#9B0000' : '#004600'));
|
||||
|
||||
echo '<span style="color:'.$font_colour.'">'.$wp_optimize->format_size($overhead_usage).'</span>';
|
||||
|
||||
?>
|
||||
</th>
|
||||
<th><?php _e('Actions', 'wp-optimize'); ?></th>
|
||||
</tr>
|
||||
</tbody>
|
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
if (!defined('WPO_VERSION')) die('No direct access allowed');
|
||||
|
||||
if ($load_data) {
|
||||
$optimizer = WP_Optimize()->get_optimizer();
|
||||
list ($db_size, $total_gain) = $optimizer->get_current_db_size();
|
||||
}
|
||||
|
||||
?>
|
||||
<h3><?php _e('Total size of database:', 'wp-optimize'); ?> <span id="optimize_current_db_size"><?php
|
||||
if ($load_data) {
|
||||
echo $db_size;
|
||||
} else {
|
||||
echo '...';
|
||||
}
|
||||
?></span></h3>
|
||||
|
||||
<?php
|
||||
if ($optimize_db) {
|
||||
?>
|
||||
|
||||
<h3><?php _e('Optimization results:', 'wp-optimize'); ?></h3>
|
||||
<p style="color: #0000ff;" id="optimization_table_total_gain">
|
||||
<?php
|
||||
if ($total_gain > 0) {
|
||||
echo __('Total space saved:', 'wp-optimize').' <span>'.$wp_optimize->format_size($total_gain).'</span> ';
|
||||
$optimizer->update_total_cleaned(strval($total_gain));
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/html" id="tmpl-wpo-table-delete">
|
||||
<h3><span class="dashicons dashicons-warning"></span> <?php _e('Are you sure?', 'wp-optimize'); ?></h3>
|
||||
<div class="notice notice-warning">
|
||||
<p><?php _e('WARNING - some plugins might not be detected as installed or activated if they are in unknown folders (for example premium plugins).', 'wp-optimize').' '.__('Only delete a table if you are sure of what you are doing, and after taking a backup.', 'wp-optimize'); ?></p>
|
||||
<p><?php _e('If none of the plugins listed were ever installed on this website, you should not delete this table as it is likely to be used by an unlisted plugin.', 'wp-optimize'); ?></p>
|
||||
</div>
|
||||
<h4><?php printf(__('You are about to remove the table %s.', 'wp-optimize'), '<span class="table-name">{{data.table_name}}</span>'); ?></h4>
|
||||
<div class="wpo-table-delete--plugins">
|
||||
{{{data.plugins_list}}}
|
||||
</div>
|
||||
<# if (data.no_backup) { #>
|
||||
<p class="no-backup-detected">
|
||||
<input type="checkbox" id="confirm_deletion_without_backup"> <strong><?php _e('No automatic backup was detected.', 'wp-optimize'); ?></strong> <?php _e('I confirm that I will be able to revert the changes if needed.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
<# } #>
|
||||
<p>
|
||||
<input type="checkbox" id="confirm_table_deletion"> <?php _e('I confirm that I have understood the risks in doing that, and that I know what I am doing.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" id="ignores_table_delete_warning"> <?php _e('Do not show this warning again.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
<button type="button" class="button button-primary delete-table" disabled><?php _e('Remove the table', 'wp-optimize'); ?></button>
|
||||
<button type="button" class="button cancel wpo-modal--close"><?php _e('Cancel', 'wp-optimize'); ?></button>
|
||||
</script>
|
@ -0,0 +1,69 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
<div class="wpo_shade hidden">
|
||||
<div class="wpo_shade_inner">
|
||||
<span class="dashicons dashicons-update-alt wpo-rotate"></span>
|
||||
<h4><?php _e('Loading data...', 'wp-optimize'); ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// This next bit belongs somewhere else, I think.
|
||||
?>
|
||||
<?php if ($optimize_db) { ?>
|
||||
<p><?php _e('Optimized all the tables found in the database.', 'wp-optimize'); ?></p>
|
||||
<?php } ?>
|
||||
<?php
|
||||
|
||||
// used for output premium functionality
|
||||
do_action('wpo_tables_list_before');
|
||||
|
||||
?>
|
||||
|
||||
<?php $wp_optimize->include_template('take-a-backup.php', false, array('label' => __('Take a backup with UpdraftPlus before any actions upon tables (recommended).', 'wp-optimize'), 'default_checkbox_value' => 'true', 'checkbox_name' => 'enable-auto-backup-1')); ?>
|
||||
|
||||
<p class="wpo-table-list-filter"><strong><?php echo __('Database name:', 'wp-optimize')." '".htmlspecialchars(DB_NAME)."'"; ?><a id="wp_optimize_table_list_refresh" href="#" class="wpo-refresh-button"><span class="dashicons dashicons-image-rotate"></span><?php _e('Refresh data', 'wp-optimize'); ?></a></strong> <input id="wpoptimize_table_list_filter" class="search" type="search" value="" placeholder="<?php esc_attr_e('Search for table', 'wp-optimize'); ?>" data-column="1" /></p>
|
||||
|
||||
<?php
|
||||
$optimizer = WP_Optimize()->get_optimizer();
|
||||
$table_prefix = $optimizer->get_table_prefix();
|
||||
if (!$table_prefix) {
|
||||
?>
|
||||
<p class="wpo-table-list-filter"><span style="color: #0073aa;"><span class="dashicons dashicons-info"></span> <?php echo __('Note:', 'wp-optimize').'</span> '.__('Your WordPress install does not use a database prefix, so WP-Optimize was not able to differentiate which tables belong to WordPress so all tables are listed below.', 'wp-optimize'); ?></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<table id="wpoptimize_table_list" class="wp-list-table widefat striped tablesorter wp-list-table-mobile-labels">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e('No.', 'wp-optimize'); ?></th>
|
||||
<th class="column-primary"><?php _e('Table', 'wp-optimize'); ?></th>
|
||||
<th><?php _e('Records', 'wp-optimize'); ?></th>
|
||||
<th><?php _e('Data Size', 'wp-optimize'); ?></th>
|
||||
<th><?php _e('Index Size', 'wp-optimize'); ?></th>
|
||||
<th><?php _e('Type', 'wp-optimize'); ?></th>
|
||||
<th><?php _e('Overhead', 'wp-optimize'); ?></th>
|
||||
<th><?php _e('Actions', 'wp-optimize'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
if ($load_data) {
|
||||
WP_Optimize()->include_template('database/tables-body.php', false, array('optimize_db' => $optimize_db));
|
||||
} else {
|
||||
?>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="loading" align="center" colspan="6"><img class="wpo-ajax-template-loader" width="16" height="16" src="<?php echo admin_url(); ?>images/spinner-2x.gif" /> <?php _e('Loading tables list...', 'wp-optimize'); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
|
||||
<div id="wpoptimize_table_list_tables_not_found"><?php _e('Tables not found.', 'wp-optimize'); ?></div>
|
||||
|
||||
<?php
|
||||
|
||||
WP_Optimize()->include_template('database/tables-list-after.php', false, array('optimize_db' => $optimize_db, 'load_data' => $load_data));
|
Reference in New Issue
Block a user