From 2c0a6fefae248ec72fd46a1e4e13a73d9f02d53f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 12 Jan 2023 00:19:12 +0000 Subject: [PATCH] Upgrade/Install: Revert a temporary conditional for testing the Rollbacks feature project. The [https://make.wordpress.org/core/2021/02/19/feature-plugin-rollback-update-failure/ Rollback Update Failure feature project] has been split into two plugins for testing: * [https://github.com/afragen/faster-updates Faster Updates] speeds up plugin or theme updates by moving files rather than copying them, thus decreasing the memory usage and reducing the chance of timeouts or running out of disk space during updates. * [https://wordpress.org/plugins/rollback-update-failure/ Rollback Update Failure] creates a temporary backup of plugins and themes before updating. This aims to make the update process more reliable and ensure that if a plugin or theme update fails, the previous version can be safely restored. The current priority of the feature project is to test the new `move_dir()` function, which offers better performance than `copy_dir()`. Instead of copying a directory in a recursive manner file by file from one location to another, `move_dir()` uses the `rename()` PHP function to speed up the process, which is instrumental in updating large plugins without a delay. If the renaming failed, it falls back to the `copy_dir()` WP function. The `move_dir()` function is self-contained in the Faster Updates plugin and does not require any special hooks in core, so the conditional previously added to `WP_Upgrader::install_package()` to facilitate testing is no longer needed and can be removed. Follow-up to [53578], [54484], [54643]. Props afragen, costdev, peterwilsoncc. See #56057, #57375, #57386. Built from https://develop.svn.wordpress.org/trunk@55055 git-svn-id: http://core.svn.wordpress.org/trunk@54588 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-upgrader.php | 28 +++++-------------------- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 88c6d5d604..c1d65972c8 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -594,35 +594,17 @@ class WP_Upgrader { } // Copy new version of item into place. - if ( class_exists( 'Rollback_Update_Failure\WP_Upgrader' ) - && function_exists( '\Rollback_Update_Failure\move_dir' ) - ) { - /* - * If the {@link https://wordpress.org/plugins/rollback-update-failure/ Rollback Update Failure} - * feature plugin is installed, use the move_dir() function from there for better performance. - * Instead of copying a directory from one location to another, it uses the rename() PHP function - * to speed up the process. If the renaming failed, it falls back to copy_dir(). - * - * This condition aims to facilitate broader testing of the Rollbacks (temp backups) feature project. - * It is temporary, until the plugin is merged into core. - */ - $result = \Rollback_Update_Failure\move_dir( $source, $remote_destination ); - } else { - $result = copy_dir( $source, $remote_destination ); - } - - if ( is_wp_error( $result ) ) { - if ( $args['clear_working'] ) { - $wp_filesystem->delete( $remote_source, true ); - } - return $result; - } + $result = copy_dir( $source, $remote_destination ); // Clear the working folder? if ( $args['clear_working'] ) { $wp_filesystem->delete( $remote_source, true ); } + if ( is_wp_error( $result ) ) { + return $result; + } + $destination_name = basename( str_replace( $local_destination, '', $destination ) ); if ( '.' === $destination_name ) { $destination_name = ''; diff --git a/wp-includes/version.php b/wp-includes/version.php index 15eebf84e6..79a045d8b5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-55054'; +$wp_version = '6.2-alpha-55055'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.