WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/11/2013 04:05:13 PM (6 years ago)
Author:
nacin
Message:

Refine error codes throughout the upgrader so we can better detect at what stage updates fail.

see #22704.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update-core.php

    r25658 r25763  
    662662    if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) {
    663663         $wp_filesystem->delete( $from, true );
    664          return new WP_Error( 'copy_failed', __('Could not copy file.') );
     664         return new WP_Error( 'copy_failed_for_version_file', __( 'Could not copy file.' ) );
    665665    }
    666666
     
    742742
    743743        // If we don't have enough free space, it isn't worth trying again
    744         if ( $total_size >= disk_free_space( ABSPATH ) )
     744        if ( $total_size >= disk_free_space( ABSPATH ) ) {
    745745            $result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ), $to );
    746         else
     746        } else {
    747747            $result = _copy_dir( $from . $distro, $to, $skip );
     748            if ( is_wp_error( $result ) )
     749                $result = new WP_Error( $result->get_error_code() . '_retry', $result->get_error_message(), $result->get_error_data() );
     750        }
    748751    }
    749752
     
    801804
    802805                    if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) )
    803                         $result = new WP_Error('copy_failed', __('Could not copy file.'), $dest . $filename);
     806                        $result = new WP_Error( 'copy_failed_for_new_bundled', __( 'Could not copy file.' ), $dest . $filename );
    804807                } else {
    805808                    if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) )
     
    888891                $wp_filesystem->chmod($to . $filename, 0644);
    889892                if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
    890                     return new WP_Error('copy_failed', __('Could not copy file.'), $to . $filename);
     893                    return new WP_Error( 'copy_failed__copy_dir', __( 'Could not copy file.' ), $to . $filename );
    891894            }
    892895        } elseif ( 'd' == $fileinfo['type'] ) {
    893896            if ( !$wp_filesystem->is_dir($to . $filename) ) {
    894897                if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
    895                     return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename);
     898                    return new WP_Error( 'mkdir_failed__copy_dir', __( 'Could not create directory.' ), $to . $filename );
    896899            }
    897900
Note: See TracChangeset for help on using the changeset viewer.