Changeset 25763
- Timestamp:
- 10/11/2013 04:05:13 PM (12 years ago)
- Location:
- trunk/src/wp-admin/includes
- Files:
-
- 3 edited
-
class-wp-upgrader.php (modified) (7 diffs)
-
file.php (modified) (8 diffs)
-
update-core.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r25755 r25763 214 214 $source = trailingslashit($source) . trailingslashit($source_files[0]); 215 215 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? 217 217 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. 218 218 $source = trailingslashit($source); … … 263 263 if ( !$wp_filesystem->exists($remote_destination) ) 264 264 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 ); 266 266 267 267 // Copy new version of item into place. … … 624 624 625 625 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.' ) ); 627 627 628 628 return $source; … … 990 990 // A proper archive should have a style.css file in the single subdirectory 991 991 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.' ) ); 993 993 994 994 $info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Template' => 'Template' ) ); 995 995 996 996 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." ) ); 998 998 999 999 // If it's not a child theme, it must have at least an index.php to be legit. 1000 1000 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.' ) ); 1002 1002 1003 1003 return $source; … … 1142 1142 if ( ! $wp_filesystem->exists( $remote_destination ) ) 1143 1143 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 ); 1145 1145 1146 1146 foreach ( $language_updates as $language_update ) { … … 1201 1201 1202 1202 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'], 1204 1204 __( 'The language pack is missing either the <code>.po</code> or <code>.mo</code> files.' ) ); 1205 1205 … … 1288 1288 if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) { 1289 1289 $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'] ); 1291 1291 } 1292 1292 $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE); -
trunk/src/wp-admin/includes/file.php
r25739 r25763 604 604 for ( $i = 0; $i < $z->numFiles; $i++ ) { 605 605 if ( ! $info = $z->statIndex($i) ) 606 return new WP_Error( 'stat_failed', __('Could not retrieve file from archive.'));606 return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); 607 607 608 608 if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory … … 634 634 foreach ( $needed_dirs as $_dir ) { 635 635 if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir) ) // Only check to see if the Dir exists upon creation failure. Less I/O this way. 636 return new WP_Error( 'mkdir_failed', __('Could not create directory.'), $_dir);636 return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), $_dir ); 637 637 } 638 638 unset($needed_dirs); … … 640 640 for ( $i = 0; $i < $z->numFiles; $i++ ) { 641 641 if ( ! $info = $z->statIndex($i) ) 642 return new WP_Error( 'stat_failed', __('Could not retrieve file from archive.'));642 return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); 643 643 644 644 if ( '/' == substr($info['name'], -1) ) // directory … … 650 650 $contents = $z->getFromIndex($i); 651 651 if ( false === $contents ) 652 return new WP_Error( 'extract_failed', __('Could not extract file from archive.'), $info['name']);652 return new WP_Error( 'extract_failed_ziparchive', __( 'Could not extract file from archive.' ), $info['name'] ); 653 653 654 654 if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) ) 655 return new WP_Error( 'copy_failed', __('Could not copy file.'), $to . $info['name']);655 return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' ), $to . $info['name'] ); 656 656 } 657 657 … … 692 692 693 693 if ( 0 == count($archive_files) ) 694 return new WP_Error( 'empty_archive', __('Empty archive.'));694 return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) ); 695 695 696 696 // Determine any children directories needed (From within the archive) … … 721 721 foreach ( $needed_dirs as $_dir ) { 722 722 if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir) ) // Only check to see if the dir exists upon creation failure. Less I/O this way. 723 return new WP_Error( 'mkdir_failed', __('Could not create directory.'), $_dir);723 return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), $_dir ); 724 724 } 725 725 unset($needed_dirs); … … 734 734 735 735 if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) ) 736 return new WP_Error( 'copy_failed', __('Could not copy file.'), $to . $file['filename']);736 return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $to . $file['filename'] ); 737 737 } 738 738 return true; … … 767 767 $wp_filesystem->chmod($to . $filename, 0644); 768 768 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) 769 return new WP_Error( 'copy_failed', __('Could not copy file.'), $to . $filename);769 return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename ); 770 770 } 771 771 } elseif ( 'd' == $fileinfo['type'] ) { 772 772 if ( !$wp_filesystem->is_dir($to . $filename) ) { 773 773 if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) 774 return new WP_Error( 'mkdir_failed', __('Could not create directory.'), $to . $filename);774 return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename ); 775 775 } 776 776 -
trunk/src/wp-admin/includes/update-core.php
r25658 r25763 662 662 if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) { 663 663 $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.' ) ); 665 665 } 666 666 … … 742 742 743 743 // 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 ) ) { 745 745 $result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ), $to ); 746 else746 } else { 747 747 $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 } 748 751 } 749 752 … … 801 804 802 805 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 ); 804 807 } else { 805 808 if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) ) … … 888 891 $wp_filesystem->chmod($to . $filename, 0644); 889 892 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 ); 891 894 } 892 895 } elseif ( 'd' == $fileinfo['type'] ) { 893 896 if ( !$wp_filesystem->is_dir($to . $filename) ) { 894 897 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 ); 896 899 } 897 900
Note: See TracChangeset
for help on using the changeset viewer.