WordPress.org

Make WordPress Core

Changeset 42654


Ignore:
Timestamp:
02/06/2018 12:46:50 PM (5 months ago)
Author:
dd32
Message:

Updates: Partially revert [42584], as this branch of code should always be run after a core update check.

This code branch is responsible for running all autoupdates, including plugins and themes - which should run regardless of if there's a core autoupdate available.

This revert does not revert the $timeout changes, as these should still use cached data if it's available.
Ideally this should be decoupled from the core update check to allow background updates to operate even when the core update check is disabled or running more often than twice daily.

Merges [42653] to the 4.9 branch.
Fixes #43103, #43235.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/update.php

    r42586 r42654  
    169169    }
    170170
    171     $offers          = $body['offers'];
    172     $has_auto_update = false;
     171    $offers = $body['offers'];
    173172
    174173    foreach ( $offers as &$offer ) {
     
    184183        $offer = (object) array_intersect_key( $offer, array_fill_keys( array( 'response', 'download', 'locale',
    185184            'packages', 'current', 'version', 'php_version', 'mysql_version', 'new_bundled', 'partial_version', 'notify_email', 'support_email', 'new_files' ), '' ) );
    186 
    187         if ( 'autoupdate' == $offer->response ) {
    188             $has_auto_update = true;
    189         }
    190185    }
    191186
     
    209204
    210205    // Trigger background updates if running non-interactively, and we weren't called from the update handler.
    211     if ( $doing_cron && $has_auto_update && ! doing_action( 'wp_maybe_auto_update' ) ) {
    212         include_once( ABSPATH . '/wp-admin/includes/update.php' );
    213 
    214         // Only trigger background updates if an acceptable autoupdate is on offer, avoids needless extra API calls.
    215         if ( find_core_auto_update() ) {
    216             do_action( 'wp_maybe_auto_update' );
    217         }
     206    if ( $doing_cron && ! doing_action( 'wp_maybe_auto_update' ) ) {
     207        do_action( 'wp_maybe_auto_update' );
    218208    }
    219209}
Note: See TracChangeset for help on using the changeset viewer.