Make WordPress Core


Ignore:
Timestamp:
11/10/2011 07:41:44 PM (15 years ago)
Author:
ryan
Message:

More specific error strings for failed theme and plugin package uploads. Props dd32. fixes #14999

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-upgrader.php

    r19115 r19246  
    5353                $this->strings['folder_exists'] = __('Destination folder already exists.');
    5454                $this->strings['mkdir_failed'] = __('Could not create directory.');
    55                 $this->strings['incompatible_archive'] = __('The package is corrupt or not in the correct format.');
     55                $this->strings['incompatible_archive'] = __('The package could not be installed.');
    5656
    5757                $this->strings['maintenance_start'] = __('Enabling Maintenance mode…');
    … …  
    194194                        $source = trailingslashit($source) . trailingslashit($source_files[0]);
    195195                elseif ( count($source_files) == 0 )
    196                         return new WP_Error('incompatible_archive', $this->strings['incompatible_archive']); //There are no files?
     196                        return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __( 'The plugin contains no files.' ) ); //There are no files?
    197197                else //Its only a single file, The upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename.
    198198                        $source = trailingslashit($source);
    … …  
    563563
    564564                if ( ! $plugins_found )
    565                         return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'] );
     565                        return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('No valid plugins were found.') );
    566566
    567567                return $source;
    … …  
    837837
    838838                if ( ! file_exists( $working_directory . 'style.css' ) ) // A proper archive should have a style.css file in the single subdirectory
    839                         return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'] );
     839                        return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('The theme is missing the <code>style.css</code> stylesheet.') );
    840840
    841841                $info = get_theme_data( $working_directory . 'style.css' );
    842842                if ( empty($info['Name']) )
    843                         return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'] );
     843                        return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __("The <code>style.css</code> stylesheet doesn't contain a valid theme header.") );
    844844
    845845                if ( empty($info['Template']) && ! file_exists( $working_directory . 'index.php' ) ) // If no template is set, it must have at least an index.php to be legit.
    846                         return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'] );
     846                        return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('The theme is missing the <code>index.php</code> file.') );
    847847
    848848                return $source;
Note: See TracChangeset for help on using the changeset viewer.