Changeset 52289
- Timestamp:
- 11/30/2021 07:10:31 PM (3 years ago)
- Location:
- trunk/src/wp-admin/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r52284 r52289 629 629 630 630 // Move new version of item into place. 631 $result = move_dir( $source, $remote_destination );631 $result = move_dir( $source, $remote_destination, $remote_source ); 632 632 if ( is_wp_error( $result ) ) { 633 633 if ( $args['clear_working'] ) { … … 637 637 } 638 638 639 // Clear the working folder?639 // Clear the working directory? 640 640 if ( $args['clear_working'] ) { 641 641 $wp_filesystem->delete( $remote_source, true ); … … 1048 1048 1049 1049 // Move to the temp-backup directory. 1050 if ( ! $wp_filesystem->move( $src, $dest, true) ) {1050 if ( ! move_dir( $src, $dest ) ) { 1051 1051 return new WP_Error( 'fs_temp_backup_move', $this->strings['temp_backup_move_failed'] ); 1052 1052 } … … 1082 1082 1083 1083 // Move it. 1084 if ( ! $wp_filesystem->move( $src, $dest, true) ) {1084 if ( ! move_dir( $src, $dest ) ) { 1085 1085 return new WP_Error( 'fs_temp_backup_delete', $this->strings['temp_backup_restore_failed'] ); 1086 1086 } -
trunk/src/wp-admin/includes/file.php
r52242 r52289 1954 1954 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. 1955 1955 * 1956 * @param string $from Source directory. 1957 * @param string $to Destination directory. 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. 1958 1960 * @return true|WP_Error True on success, WP_Error on failure. 1959 1961 */ 1960 function move_dir( $from, $to ) {1962 function move_dir( $from, $to, $working_dir = '' ) { 1961 1963 global $wp_filesystem; 1962 1964 1963 $wp_filesystem->rmdir( $to ); 1964 if ( @rename( $from, $to ) ) { 1965 return true; 1966 } 1967 1968 $wp_filesystem->mkdir( $to ); 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 } 1969 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 } 1970 1989 1971 1990 return $result;
Note: See TracChangeset
for help on using the changeset viewer.