This commit is contained in:
Javier Casares 2026-07-09 06:28:55 +00:00
commit db98c4438c

View file

@ -494,7 +494,7 @@ function wpvulnerability_debug_get_cron_status() {
'scheduled' => false,
),
'send_notification' => array(
'hook' => 'wpvulnerability_send_notification',
'hook' => 'wpvulnerability_notification',
'next_run' => null,
'last_run' => null,
'scheduled' => false,
@ -509,28 +509,28 @@ function wpvulnerability_debug_get_cron_status() {
}
// Check notification cron.
$next_notification = wp_next_scheduled( 'wpvulnerability_send_notification' );
$next_notification = wp_next_scheduled( 'wpvulnerability_notification' );
if ( $next_notification ) {
$cron_status['send_notification']['next_run'] = $next_notification;
$cron_status['send_notification']['scheduled'] = true;
}
// Try to get last run times from logs.
$logs_raw = is_multisite() ? get_site_option( 'wpvulnerability-logs', array() ) : get_option( 'wpvulnerability-logs', array() );
$logs = is_array( $logs_raw ) ? $logs_raw : array();
if ( ! empty( $logs ) ) {
// Get the most recent log entry for each type.
foreach ( array_reverse( $logs ) as $log ) {
if ( ! is_array( $log ) ) {
continue; }
if ( isset( $log['time'] ) && isset( $log['url'] ) ) {
$timestamp = $log['time'];
// Check if this is an update-related log.
if ( ! $cron_status['update_database']['last_run'] ) {
$cron_status['update_database']['last_run'] = $timestamp;
}
}
// Last run = most recent API response log (stored as the wpvulnerability_log CPT).
$last_log = get_posts(
array(
'post_type' => 'wpvulnerability_log',
'post_status' => 'any',
'posts_per_page' => 1,
'orderby' => 'date',
'order' => 'DESC',
'fields' => 'ids',
'no_found_rows' => true,
)
);
if ( ! empty( $last_log ) ) {
$timestamp = get_post_timestamp( $last_log[0] );
if ( false !== $timestamp ) {
$cron_status['update_database']['last_run'] = $timestamp;
}
}