Make WordPress Core

Changeset 25780


Ignore:
Timestamp:
10/14/2013 10:24:28 PM (11 years ago)
Author:
nacin
Message:

Parse absolute paths out of error data. see #22704.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

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

    r25779 r25780  
    646646    foreach ( $needed_dirs as $_dir ) {
    647647        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.
    648             return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), $_dir );
     648            return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
    649649    }
    650650    unset($needed_dirs);
     
    665665
    666666        if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) )
    667             return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' ), $to . $info['name'] );
     667            return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' ), $info['name'] );
    668668    }
    669669
     
    745745    // Create those directories if need be:
    746746    foreach ( $needed_dirs as $_dir ) {
    747         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.
    748             return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), $_dir );
     747        // 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.
     748            return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
    749749    }
    750750    unset($needed_dirs);
     
    759759
    760760        if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) )
    761             return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $to . $file['filename'] );
     761            return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
    762762    }
    763763    return true;
  • trunk/src/wp-admin/includes/update-core.php

    r25778 r25780  
    717717    // Copy new versions of WP files into place.
    718718    $result = _copy_dir( $from . $distro, $to, $skip );
     719    if ( is_wp_error( $result ) )
     720        $result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
    719721
    720722    // Check to make sure everything copied correctly, ignoring the contents of wp-content
     
    745747        $available_space = disk_free_space( ABSPATH );
    746748        if ( $available_space && $total_size >= $available_space ) {
    747             $result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ), $to );
     749            $result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) );
    748750        } else {
    749751            $result = _copy_dir( $from . $distro, $to, $skip );
    750752            if ( is_wp_error( $result ) )
    751                 $result = new WP_Error( $result->get_error_code() . '_retry', $result->get_error_message(), $result->get_error_data() );
     753                $result = new WP_Error( $result->get_error_code() . '_retry', $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
    752754        }
    753755    }
     
    771773                $result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir);
    772774                if ( is_wp_error( $result ) )
    773                     $result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), $result->get_error_data() );
     775                    $result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) );
    774776            }
    775777        }
     
    821823                        if ( ! is_wp_error( $result ) )
    822824                            $result = new WP_Error;
    823                         $result->add( $_result->get_error_code() . "_$type", $_result->get_error_message(), $_result->get_error_data() );
     825                        $result->add( $_result->get_error_code() . "_$type", $_result->get_error_message(), substr( $_result->get_error_data(), strlen( $dest ) ) );
    824826                    }
    825827                }
Note: See TracChangeset for help on using the changeset viewer.