make_result( array( 'id' => 'core_auto_updates_off', 'title' => __( 'Core auto-updates are disabled', 'aipatch-security-scanner' ), 'description' => __( 'Automatic updates for WordPress core are completely disabled.', 'aipatch-security-scanner' ), 'severity' => 'high', 'confidence' => 'high', 'category' => 'configuration', 'why_it_matters' => __( 'Security patches are often released urgently. Without auto-updates, your site remains vulnerable until you manually update.', 'aipatch-security-scanner' ), 'recommendation' => __( 'At minimum, enable minor/security auto-updates by setting WP_AUTO_UPDATE_CORE to "minor" in wp-config.php.', 'aipatch-security-scanner' ), 'dismissible' => true, 'evidence' => sprintf( 'WP_AUTO_UPDATE_CORE = %s', $core_auto_update_label ), ) ); } // Plugin auto-updates. if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $active_plugins = get_option( 'active_plugins', array() ); $auto_update_option = 'auto_update_' . 'plugins'; // Read-only access to the core option that stores plugins with auto-updates enabled. $enabled_plugin_updates = get_site_option( $auto_update_option, array() ); if ( ! is_array( $enabled_plugin_updates ) ) { $enabled_plugin_updates = array(); } $all_plugins = get_plugins(); $no_auto_update = array(); foreach ( $active_plugins as $plugin_file ) { if ( ! in_array( $plugin_file, $enabled_plugin_updates, true ) && isset( $all_plugins[ $plugin_file ] ) ) { $no_auto_update[] = $all_plugins[ $plugin_file ]['Name']; } } if ( count( $no_auto_update ) > 0 && count( $active_plugins ) > 0 ) { $pct = round( ( count( $no_auto_update ) / count( $active_plugins ) ) * 100 ); if ( $pct > 50 ) { $results[] = $this->make_result( array( 'id' => 'plugins_auto_updates_off', 'title' => sprintf( /* translators: %d: Percentage of active plugins without auto-updates enabled. */ __( '%d%% of active plugins lack auto-updates', 'aipatch-security-scanner' ), $pct ), 'description' => sprintf( /* translators: 1: Number of active plugins without auto-updates. 2: Total active plugins. */ __( '%1$d of %2$d active plugins do not have auto-updates enabled.', 'aipatch-security-scanner' ), count( $no_auto_update ), count( $active_plugins ) ), 'severity' => 'medium', 'confidence' => 'high', 'category' => 'plugins', 'why_it_matters' => __( 'Plugins without auto-updates won\'t receive security patches automatically.', 'aipatch-security-scanner' ), 'recommendation' => __( 'Enable auto-updates for trusted plugins from the Plugins page.', 'aipatch-security-scanner' ), 'dismissible' => true, 'evidence' => sprintf( '%d of %d plugins without auto-updates', count( $no_auto_update ), count( $active_plugins ) ), ) ); } } return $results; } }