Make WordPress Core


Ignore:
Timestamp:
12/10/2021 12:04:03 AM (5 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-admin/includes/file.php

    r52289 r52351  
    19451945
    19461946/**
    1947  * Moves a directory from one location to another via the rename() PHP function.
    1948  * If the renaming failed, falls back to copy_dir().
    1949  *
    1950  * Assumes that WP_Filesystem() has already been called and setup.
    1951  *
    1952  * @since 5.9.0
    1953  *
    1954  * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
    1955  *
    1956  * @param string $from        Source directory.
    1957  * @param string $to          Destination directory.
    1958  * @param string $working_dir Optional. Remote file source directory.
    1959  *                            Default empty string.
    1960  * @return true|WP_Error True on success, WP_Error on failure.
    1961  */
    1962 function move_dir( $from, $to, $working_dir = '' ) {
    1963     global $wp_filesystem;
    1964 
    1965     if ( 'direct' === $wp_filesystem->method ) {
    1966         $wp_filesystem->rmdir( $to );
    1967         if ( @rename( $from, $to ) ) {
    1968             return true;
    1969         }
    1970     }
    1971 
    1972     if ( ! $wp_filesystem->is_dir( $to ) ) {
    1973         if ( ! $wp_filesystem->mkdir( $to, FS_CHMOD_DIR ) ) {
    1974 
    1975             // Clear the working directory?
    1976             if ( ! empty( $working_dir ) ) {
    1977                 $wp_filesystem->delete( $working_dir, true );
    1978             }
    1979 
    1980             return new WP_Error( 'mkdir_failed_move_dir', __( 'Could not create directory.' ), $to );
    1981         }
    1982     }
    1983     $result = copy_dir( $from, $to );
    1984 
    1985     // Clear the working directory?
    1986     if ( ! empty( $working_dir ) ) {
    1987         $wp_filesystem->delete( $working_dir, true );
    1988     }
    1989 
    1990     return $result;
    1991 }
    1992 
    1993 /**
    19941947 * Initializes and connects the WordPress Filesystem Abstraction classes.
    19951948 *
Note: See TracChangeset for help on using the changeset viewer.