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.




git-svn-id: https://develop.svn.wordpress.org/trunk@52351 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson
2021-12-10 00:04:03 +00:00
parent 92cbcb3da6
commit db30405f47
6 changed files with 27 additions and 515 deletions

View File

@@ -956,51 +956,6 @@ function wp_clean_update_cache() {
delete_site_transient( 'update_core' );
}
/**
* Deletes all contents of the temp-backup directory.
*
* @since 5.9.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
*/
function wp_delete_all_temp_backups() {
/*
* Check if there's a lock, or if currently performing an Ajax request,
* in which case there's a chance we're doing an update.
* Reschedule for an hour from now and exit early.
*/
if ( get_option( 'core_updater.lock' ) || get_option( 'auto_updater.lock' ) || wp_doing_ajax() ) {
wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_delete_temp_updater_backups' );
return;
}
add_action(
'shutdown',
/*
* This action runs on shutdown to make sure there's no plugin updates currently running.
* Using a closure in this case is OK since the action can be removed by removing the parent hook.
*/
function() {
global $wp_filesystem;
if ( ! $wp_filesystem ) {
include_once ABSPATH . '/wp-admin/includes/file.php';
WP_Filesystem();
}
$dirlist = $wp_filesystem->dirlist( $wp_filesystem->wp_content_dir() . 'upgrade/temp-backup/' );
foreach ( array_keys( $dirlist ) as $dir ) {
if ( '.' === $dir || '..' === $dir ) {
continue;
}
$wp_filesystem->delete( $wp_filesystem->wp_content_dir() . 'upgrade/temp-backup/' . $dir, true );
}
}
);
}
if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) {
return;
}
@@ -1025,5 +980,3 @@ add_action( 'update_option_WPLANG', 'wp_clean_update_cache', 10, 0 );
add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
add_action( 'init', 'wp_schedule_update_checks' );
add_action( 'wp_delete_temp_updater_backups', 'wp_delete_all_temp_backups' );