Make WordPress Core

Changeset 59926


Ignore:
Timestamp:
03/04/2025 01:48:58 PM (7 weeks ago)
Author:
johnbillion
Message:

Upgrade/Install: Prevent an unnecessary plugin update check when the plugin update data is up to date.

This ensures the checked property is always populated with the latest plugin data before determining whether to perform an update check. Previously this was only populated when the data was already identified as being stale, which could result in a subsequent unnecessary update check when viewing the Plugins screen.

Props siliconforks, bookdude13, pbiron, francina, Cybr, snehapatil02, johnbillion

Fixes #44118, #61055

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/update.php

    r59896 r59926  
    338338    }
    339339
    340     $updates               = new stdClass();
    341     $updates->last_checked = time();
    342     $updates->response     = array();
    343     $updates->translations = array();
    344     $updates->no_update    = array();
    345 
    346340    $doing_cron = wp_doing_cron();
    347341
     
    372366
    373367        foreach ( $plugins as $file => $p ) {
    374             $updates->checked[ $file ] = $p['Version'];
    375 
    376368            if ( ! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version'] ) {
    377369                $plugin_changed = true;
     
    460452    if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) {
    461453        return;
     454    }
     455
     456    $updates               = new stdClass();
     457    $updates->last_checked = time();
     458    $updates->response     = array();
     459    $updates->translations = array();
     460    $updates->no_update    = array();
     461    foreach ( $plugins as $file => $p ) {
     462        $updates->checked[ $file ] = $p['Version'];
    462463    }
    463464
Note: See TracChangeset for help on using the changeset viewer.