Ticket #57375: 57375.diff
File 57375.diff, 1.2 KB (added by , 2 years ago) |
---|
-
src/wp-admin/includes/file.php
1971 1971 global $wp_filesystem; 1972 1972 1973 1973 if ( trailingslashit( strtolower( $from ) ) === trailingslashit( strtolower( $to ) ) ) { 1974 return new WP_Error( 1975 'source_destination_same_move_dir', 1976 __( 'The source and destination are the same.' ) 1977 ); 1974 return new WP_Error( 'source_destination_same_move_dir', __( 'The source and destination are the same.' ) ); 1978 1975 } 1979 1976 1980 if ( ! $overwrite && $wp_filesystem->exists( $to ) ) { 1977 $destination_exists = $wp_filesystem->exists( $to ); 1978 1979 if ( ! $overwrite && $destination_exists ) { 1981 1980 return new WP_Error( 'destination_already_exists_move_dir', __( 'The destination folder already exists.' ), $to ); 1982 1981 } 1983 1982 1984 if ( $overwrite && $ wp_filesystem->exists( $to )&& ! $wp_filesystem->delete( $to, true ) ) {1983 if ( $overwrite && $destination_exists && ! $wp_filesystem->delete( $to, true ) ) { 1985 1984 // Can't overwrite if the destination couldn't be deleted. 1986 1985 return WP_Error( 'destination_not_deleted_move_dir', __( 'The destination directory already exists and could not be removed.' ) ); 1987 1986 }