time() - 5 * MINUTE_IN_SECONDS ) || ( function_exists( 'as_has_scheduled_action' ) && ( as_has_scheduled_action( 'wardpair_clone_negotiate_chunk_size', null, 'wardpair' ) || as_has_scheduled_action( 'wardpair_clone_start', null, 'wardpair' ) ) ) ); // A primary that is failing its checks must not be labelled healthy while the // failure count builds towards failover. $fail_count = (int) get_option( 'wardpair_failure_count', 0 ); $is_failing = ( 'normal' === $status && $fail_count > 0 ); $fail_limit = 0; $status_class = $is_failing ? 'swp-status--amber' : ( 'normal' === $status ? 'swp-status--green' : ( 'failover' === $status ? 'swp-status--amber' : ( 'not_connected' === $status ? 'swp-status--grey' : 'swp-status--red' ) ) ); $status_label = $is_failing ? sprintf( /* translators: 1: number of failed checks, 2: number of failed checks allowed before failover */ __( 'Primary is failing checks (%1$d of %2$d before failover)', 'wardpair' ), $fail_count, $fail_limit ) : ( 'normal' === $status ? ( 'primary' === $role ? __( 'Normal — this site is the primary', 'wardpair' ) : __( 'Normal — Primary is healthy', 'wardpair' ) ) : ( 'failover' === $status ? __( 'Failover Active', 'wardpair' ) : ( 'not_connected' === $status ? __( 'Not Connected', 'wardpair' ) : __( 'Unknown', 'wardpair' ) ) ) ); // Logs are kept per connected site. $swp_view is the connection being looked at: the live one // unless ?conn= names an earlier site. $swp_view = Sentinel_Connections::viewing(); $swp_live_key = Sentinel_Connections::current(); $swp_conns = Sentinel_Connections::all(); $pings = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %i ORDER BY id DESC LIMIT 20', $wpdb->prefix . 'wardpair_pings' ), ARRAY_A ); $events = Sentinel_Connections::events( 10, $swp_view ); // "View all" on the Event Log and Sync Log cards opens the full log in place of the dashboard. $swp_log = isset( $_GET['log'] ) ? sanitize_key( wp_unslash( $_GET['log'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only choice of which log to display. if ( in_array( $swp_log, Sentinel_Log_Viewer::kinds(), true ) ) { Sentinel_Log_Viewer::render( $swp_log, $swp_view ); return; } $swp_counts = Sentinel_Connections::counts(); $swp_n_ev = (int) ( $swp_counts[ $swp_view ]['events'] ?? 0 ); $swp_n_sync = (int) ( $swp_counts[ $swp_view ]['sync'] ?? 0 ); ?>
| — | |
| ' . esc_html__( 'Free', 'wardpair' ) . '' . ' ' . esc_html__( 'Upgrade', 'wardpair' ) . ''; echo $plan_html; // phpcs:ignore WordPress.Security.EscapeOutput -- escaped where built above. ?> |