Make WordPress Core


Ignore:
Timestamp:
03/22/2011 12:04:15 AM (13 years ago)
Author:
dd32
Message:

Optimisations to WP_Filesystem; Pass known information to called functions. Props aldenta (John Ford) for investigation and patch. See #10913

File:
1 edited

Legend:

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

    r17200 r17525  
    8181    $siteurl = get_option( 'siteurl' );
    8282    if ( $home != '' && $home != $siteurl ) {
    83             $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */
    84             $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home);
    85             $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos);
     83        $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */
     84        $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home);
     85        $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos);
    8686        $home_path = trailingslashit( $home_path );
    8787    } else {
     
    774774    foreach ( (array) $dirlist as $filename => $fileinfo ) {
    775775        if ( 'f' == $fileinfo['type'] ) {
    776             if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) {
     776            if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
    777777                // If copy failed, chmod file to 0644 and try again.
    778778                $wp_filesystem->chmod($to . $filename, 0644);
    779                 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
     779                if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
    780780                    return new WP_Error('copy_failed', __('Could not copy file.'), $to . $filename);
    781781            }
    782             $wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE);
    783782        } elseif ( 'd' == $fileinfo['type'] ) {
    784783            if ( !$wp_filesystem->is_dir($to . $filename) ) {
Note: See TracChangeset for help on using the changeset viewer.