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/class-wp-upgrader.php

    r25755 r25763  
    214214            $source = trailingslashit($source) . trailingslashit($source_files[0]);
    215215        elseif ( count($source_files) == 0 )
    216             return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $this->strings['no_files'] ); //There are no files?
     216            return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
    217217        else //It's only a single file, the upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename.
    218218            $source = trailingslashit($source);
     
    263263        if ( !$wp_filesystem->exists($remote_destination) )
    264264            if ( !$wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR) )
    265                 return new WP_Error('mkdir_failed', $this->strings['mkdir_failed'], $remote_destination);
     265                return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
    266266
    267267        // Copy new version of item into place.
     
    624624
    625625        if ( ! $plugins_found )
    626             return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('No valid plugins were found.') );
     626            return new WP_Error( 'incompatible_archive_no_plugins', $this->strings['incompatible_archive'], __( 'No valid plugins were found.' ) );
    627627
    628628        return $source;
     
    990990        // A proper archive should have a style.css file in the single subdirectory
    991991        if ( ! file_exists( $working_directory . 'style.css' ) )
    992             return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('The theme is missing the <code>style.css</code> stylesheet.') );
     992            return new WP_Error( 'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'], __( 'The theme is missing the <code>style.css</code> stylesheet.' ) );
    993993
    994994        $info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Template' => 'Template' ) );
    995995
    996996        if ( empty( $info['Name'] ) )
    997             return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __("The <code>style.css</code> stylesheet doesn't contain a valid theme header.") );
     997            return new WP_Error( 'incompatible_archive_theme_no_name', $this->strings['incompatible_archive'], __( "The <code>style.css</code> stylesheet doesn't contain a valid theme header." ) );
    998998
    999999        // If it's not a child theme, it must have at least an index.php to be legit.
    10001000        if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) )
    1001             return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('The theme is missing the <code>index.php</code> file.') );
     1001            return new WP_Error( 'incompatible_archive_theme_no_index', $this->strings['incompatible_archive'], __( 'The theme is missing the <code>index.php</code> file.' ) );
    10021002
    10031003        return $source;
     
    11421142        if ( ! $wp_filesystem->exists( $remote_destination ) )
    11431143            if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) )
    1144                 return new WP_Error( 'mkdir_failed', $this->strings['mkdir_failed'], $remote_destination );
     1144                return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination );
    11451145
    11461146        foreach ( $language_updates as $language_update ) {
     
    12011201
    12021202        if ( ! $mo || ! $po )
    1203             return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'],
     1203            return new WP_Error( 'incompatible_archive_pomo', $this->strings['incompatible_archive'],
    12041204                __( 'The language pack is missing either the <code>.po</code> or <code>.mo</code> files.' ) );
    12051205
     
    12881288        if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) {
    12891289            $wp_filesystem->delete($working_dir, true);
    1290             return new WP_Error('copy_failed', $this->strings['copy_failed']);
     1290            return new WP_Error( 'copy_failed_for_update_core_file', $this->strings['copy_failed'] );
    12911291        }
    12921292        $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
Note: See TracChangeset for help on using the changeset viewer.