Automatic WordPress security: local firewall, malware and file-integrity scanning, vulnerability protection, quarantine, scheduled backups, an optional page cache, and automatic global threat intelligence. See README.md for installation, update, and uninstall instructions.
135 lines
8.0 KiB
PHP
135 lines
8.0 KiB
PHP
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
$argus_active_page = 'backups';
|
|
include ARGUS_WPD_DIR . 'admin/views/partials/header.php';
|
|
|
|
$date_format = 'd M Y, H:i';
|
|
$last_backup_display = $backup_status['last_backup'] ? wp_date( $date_format, strtotime( $backup_status['last_backup'] . ' UTC' ) ) : __( 'None yet', 'argus-wordpress-defence' );
|
|
$next_backup_display = $backup_status['next_backup'] ? wp_date( $date_format, strtotime( $backup_status['next_backup'] . ' UTC' ) ) : __( 'Not scheduled', 'argus-wordpress-defence' );
|
|
|
|
$schedule_mode = Argus_Settings::get( 'backup_schedule_mode', 'automatic' );
|
|
$interval_hours = (int) Argus_Settings::get( 'backup_interval_hours', 24 );
|
|
$lockdown = Argus_Backup::lockdown_status();
|
|
?>
|
|
|
|
<h1 class="argus-wpd-page-title"><?php esc_html_e( 'Backups', 'argus-wordpress-defence' ); ?></h1>
|
|
<p style="color:var(--muted);font-size:13px;margin:0 0 20px;"><?php esc_html_e( 'ARGUS can create scheduled recovery points for your WordPress website.', 'argus-wordpress-defence' ); ?></p>
|
|
|
|
<?php if ( ! empty( $notice ) ) : ?>
|
|
<div class="notice notice-<?php echo esc_attr( $notice_type ); ?>" style="padding:14px 18px;margin:0 0 20px;"><p style="margin:0"><?php echo esc_html( $notice ); ?></p></div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ( 'active' !== $lockdown ) : ?>
|
|
<div class="notice notice-warning" style="padding:14px 18px;margin:0 0 20px;">
|
|
<p style="margin:0"><?php esc_html_e( 'ARGUS could not secure the backup storage location on this host (a permissions issue in wp-content/uploads). Backups are not available until this is resolved.', 'argus-wordpress-defence' ); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="argus-wpd-metric-grid">
|
|
<div class="argus-wpd-metric-card">
|
|
<div class="argus-wpd-metric-label"><?php esc_html_e( 'Last Backup', 'argus-wordpress-defence' ); ?></div>
|
|
<div class="argus-wpd-metric-value" style="font-size:18px;"><?php echo esc_html( $last_backup_display ); ?></div>
|
|
</div>
|
|
<div class="argus-wpd-metric-card">
|
|
<div class="argus-wpd-metric-label"><?php esc_html_e( 'Next Backup', 'argus-wordpress-defence' ); ?></div>
|
|
<div class="argus-wpd-metric-value" style="font-size:18px;"><?php echo esc_html( $next_backup_display ); ?></div>
|
|
</div>
|
|
<div class="argus-wpd-metric-card">
|
|
<div class="argus-wpd-metric-label"><?php esc_html_e( 'Backup Status', 'argus-wordpress-defence' ); ?></div>
|
|
<div class="argus-wpd-metric-value" style="color:<?php echo 'active' === $lockdown ? 'var(--emerald)' : 'var(--rose)'; ?>;font-size:18px;"><?php echo 'active' === $lockdown ? esc_html__( 'Protected', 'argus-wordpress-defence' ) : esc_html__( 'Unavailable', 'argus-wordpress-defence' ); ?></div>
|
|
</div>
|
|
<div class="argus-wpd-metric-card">
|
|
<div class="argus-wpd-metric-label"><?php esc_html_e( 'Available Recovery Points', 'argus-wordpress-defence' ); ?></div>
|
|
<div class="argus-wpd-metric-value"><?php echo esc_html( number_format_i18n( $backup_status['available'] ) ); ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="argus-wpd-panel">
|
|
<h2><?php esc_html_e( 'Create a backup now', 'argus-wordpress-defence' ); ?></h2>
|
|
<form method="post">
|
|
<?php wp_nonce_field( 'argus_wpd_backup_create', 'argus_wpd_backup_create_nonce' ); ?>
|
|
<button type="submit" class="button button-primary" <?php disabled( 'active' !== $lockdown ); ?>><?php esc_html_e( 'Create Backup Now', 'argus-wordpress-defence' ); ?></button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="argus-wpd-panel">
|
|
<h2><?php esc_html_e( 'Backup Schedule', 'argus-wordpress-defence' ); ?></h2>
|
|
<form method="post">
|
|
<?php wp_nonce_field( 'argus_wpd_backup_schedule', 'argus_wpd_backup_schedule_nonce' ); ?>
|
|
<table class="form-table">
|
|
<tr>
|
|
<th><?php esc_html_e( 'Schedule', 'argus-wordpress-defence' ); ?></th>
|
|
<td>
|
|
<label><input type="radio" name="backup_schedule_mode" value="automatic" <?php checked( $schedule_mode, 'automatic' ); ?> /> <?php esc_html_e( 'Automatic -- recommended, based on your active protection profile', 'argus-wordpress-defence' ); ?></label><br>
|
|
<label><input type="radio" name="backup_schedule_mode" value="custom" <?php checked( $schedule_mode, 'custom' ); ?> /> <?php esc_html_e( 'Custom', 'argus-wordpress-defence' ); ?>
|
|
<select name="backup_interval_hours">
|
|
<option value="1" <?php selected( $interval_hours, 1 ); ?>><?php esc_html_e( 'Every 1 hour', 'argus-wordpress-defence' ); ?></option>
|
|
<option value="6" <?php selected( $interval_hours, 6 ); ?>><?php esc_html_e( 'Every 6 hours', 'argus-wordpress-defence' ); ?></option>
|
|
<option value="12" <?php selected( $interval_hours, 12 ); ?>><?php esc_html_e( 'Every 12 hours', 'argus-wordpress-defence' ); ?></option>
|
|
<option value="24" <?php selected( $interval_hours, 24 ); ?>><?php esc_html_e( 'Every 24 hours', 'argus-wordpress-defence' ); ?></option>
|
|
<option value="168" <?php selected( $interval_hours, 168 ); ?>><?php esc_html_e( 'Every 7 days', 'argus-wordpress-defence' ); ?></option>
|
|
</select>
|
|
</label><br>
|
|
<label><input type="radio" name="backup_schedule_mode" value="manual" <?php checked( $schedule_mode, 'manual' ); ?> /> <?php esc_html_e( 'Manual -- only when I click Create Backup Now', 'argus-wordpress-defence' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<button type="submit" class="button"><?php esc_html_e( 'Save Schedule', 'argus-wordpress-defence' ); ?></button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="argus-wpd-panel">
|
|
<h2><?php esc_html_e( 'Available Recovery Points', 'argus-wordpress-defence' ); ?></h2>
|
|
<?php if ( empty( $backups ) ) : ?>
|
|
<p class="argus-wpd-empty"><?php esc_html_e( 'No backups yet.', 'argus-wordpress-defence' ); ?></p>
|
|
<?php else : ?>
|
|
<table class="widefat striped">
|
|
<thead>
|
|
<tr>
|
|
<th><?php esc_html_e( 'Date', 'argus-wordpress-defence' ); ?></th>
|
|
<th><?php esc_html_e( 'Type', 'argus-wordpress-defence' ); ?></th>
|
|
<th><?php esc_html_e( 'Size', 'argus-wordpress-defence' ); ?></th>
|
|
<th><?php esc_html_e( 'Status', 'argus-wordpress-defence' ); ?></th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ( $backups as $backup ) : ?>
|
|
<tr>
|
|
<td><?php echo esc_html( wp_date( $date_format, strtotime( $backup->created_at . ' UTC' ) ) ); ?></td>
|
|
<td><?php echo esc_html( Argus_Backup::TYPE_MANUAL === $backup->type ? __( 'Manual', 'argus-wordpress-defence' ) : __( 'Scheduled', 'argus-wordpress-defence' ) ); ?></td>
|
|
<td><?php echo esc_html( Argus_Backup::STATUS_COMPLETE === $backup->status ? size_format( (int) $backup->size_bytes ) : '—' ); ?></td>
|
|
<td>
|
|
<?php if ( Argus_Backup::STATUS_COMPLETE === $backup->status ) : ?>
|
|
<span style="color:var(--emerald);font-weight:600;"><?php esc_html_e( 'Complete', 'argus-wordpress-defence' ); ?></span>
|
|
<?php else : ?>
|
|
<span style="color:var(--rose);font-weight:600;" title="<?php echo esc_attr( $backup->error_message ); ?>"><?php esc_html_e( 'Failed', 'argus-wordpress-defence' ); ?></span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php if ( Argus_Backup::STATUS_COMPLETE === $backup->status ) : ?>
|
|
<a class="button" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=argus_wpd_download_backup&id=' . $backup->id ), 'argus_wpd_backup_download_' . $backup->id ) ); ?>"><?php esc_html_e( 'Download', 'argus-wordpress-defence' ); ?></a>
|
|
<?php endif; ?>
|
|
<form method="post" style="display:inline">
|
|
<?php wp_nonce_field( 'argus_wpd_backup_delete_' . $backup->id, 'argus_wpd_backup_delete_nonce' ); ?>
|
|
<input type="hidden" name="backup_id" value="<?php echo esc_attr( $backup->id ); ?>" />
|
|
<button type="submit" class="button" style="color:var(--rose)" onclick="return confirm('<?php echo esc_js( __( 'Delete this backup permanently? This cannot be undone.', 'argus-wordpress-defence' ) ); ?>')"><?php esc_html_e( 'Delete', 'argus-wordpress-defence' ); ?></button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php
|
|
$base_url = remove_query_arg( 'paged' );
|
|
include ARGUS_WPD_DIR . 'admin/views/partials/pagination.php';
|
|
?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php include ARGUS_WPD_DIR . 'admin/views/partials/footer.php'; ?>
|