| 1 |
<?php |
| 2 |
/** |
| 3 |
* Activity Log tools view. |
| 4 |
* |
| 5 |
* @package King_Addons |
| 6 |
*/ |
| 7 |
|
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
$total_logs = $this->get_logs_count([]); |
| 13 |
$retention_days = (int) ($settings['retention_days'] ?? 14); |
| 14 |
if (!$is_pro) { |
| 15 |
$retention_days = min($retention_days, 14); |
| 16 |
} |
| 17 |
?> |
| 18 |
|
| 19 |
<div class="ka-card"> |
| 20 |
<div class="ka-card-header"> |
| 21 |
<span class="dashicons dashicons-database purple"></span> |
| 22 |
<h2><?php esc_html_e('Database Summary', 'king-addons'); ?></h2> |
| 23 |
</div> |
| 24 |
<div class="ka-card-body"> |
| 25 |
<div class="kng-activity-summary-grid"> |
| 26 |
<div> |
| 27 |
<span class="kng-activity-muted"><?php esc_html_e('Total log entries', 'king-addons'); ?></span> |
| 28 |
<strong><?php echo esc_html(number_format_i18n($total_logs)); ?></strong> |
| 29 |
</div> |
| 30 |
<div> |
| 31 |
<span class="kng-activity-muted"><?php esc_html_e('Retention', 'king-addons'); ?></span> |
| 32 |
<strong><?php echo esc_html(number_format_i18n($retention_days)); ?> <?php esc_html_e('days', 'king-addons'); ?></strong> |
| 33 |
</div> |
| 34 |
</div> |
| 35 |
</div> |
| 36 |
</div> |
| 37 |
|
| 38 |
<div class="ka-card"> |
| 39 |
<div class="ka-card-header"> |
| 40 |
<span class="dashicons dashicons-trash purple"></span> |
| 41 |
<h2><?php esc_html_e('Purge Old Logs', 'king-addons'); ?></h2> |
| 42 |
</div> |
| 43 |
<div class="ka-card-body"> |
| 44 |
<p><?php esc_html_e('Run the retention cleanup now. This removes entries older than the configured retention window.', 'king-addons'); ?></p> |
| 45 |
<form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>"> |
| 46 |
<input type="hidden" name="action" value="kng_activity_log_purge"> |
| 47 |
<?php wp_nonce_field('kng_activity_log_purge'); ?> |
| 48 |
<button type="submit" class="ka-btn ka-btn-secondary"> |
| 49 |
<?php esc_html_e('Purge Now', 'king-addons'); ?> |
| 50 |
</button> |
| 51 |
</form> |
| 52 |
</div> |
| 53 |
</div> |
| 54 |
|