Make WordPress Core


Ignore:
Timestamp:
12/10/2021 12:04:03 AM (3 years ago)
Author:
peterwilsoncc
Message:

Upgrade/install: Revert upgrader rollback features.

Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.

Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].

Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.

File:
1 edited

Legend:

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

    r52192 r52351  
    957957}
    958958
    959 /**
    960  * Deletes all contents of the temp-backup directory.
    961  *
    962  * @since 5.9.0
    963  *
    964  * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
    965  */
    966 function wp_delete_all_temp_backups() {
    967     /*
    968      * Check if there's a lock, or if currently performing an Ajax request,
    969      * in which case there's a chance we're doing an update.
    970      * Reschedule for an hour from now and exit early.
    971      */
    972     if ( get_option( 'core_updater.lock' ) || get_option( 'auto_updater.lock' ) || wp_doing_ajax() ) {
    973         wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_delete_temp_updater_backups' );
    974         return;
    975     }
    976 
    977     add_action(
    978         'shutdown',
    979         /*
    980          * This action runs on shutdown to make sure there's no plugin updates currently running.
    981          * Using a closure in this case is OK since the action can be removed by removing the parent hook.
    982          */
    983         function() {
    984             global $wp_filesystem;
    985 
    986             if ( ! $wp_filesystem ) {
    987                 include_once ABSPATH . '/wp-admin/includes/file.php';
    988                 WP_Filesystem();
    989             }
    990 
    991             $dirlist = $wp_filesystem->dirlist( $wp_filesystem->wp_content_dir() . 'upgrade/temp-backup/' );
    992 
    993             foreach ( array_keys( $dirlist ) as $dir ) {
    994                 if ( '.' === $dir || '..' === $dir ) {
    995                     continue;
    996                 }
    997 
    998                 $wp_filesystem->delete( $wp_filesystem->wp_content_dir() . 'upgrade/temp-backup/' . $dir, true );
    999             }
    1000         }
    1001     );
    1002 }
    1003 
    1004959if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) {
    1005960    return;
     
    1026981
    1027982add_action( 'init', 'wp_schedule_update_checks' );
    1028 
    1029 add_action( 'wp_delete_temp_updater_backups', 'wp_delete_all_temp_backups' );
Note: See TracChangeset for help on using the changeset viewer.