Make WordPress Core


Ignore:
Timestamp:
05/29/2008 05:29:32 PM (18 years ago)
Author:
ryan
Message:

Make WP_Filesystem work with new directory constants. Props DD32. fixes #7059

File:
1 edited

Legend:

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

    r7999 r8009  
    3535function get_real_file_to_edit( $file ) {
    3636        if ('index.php' == $file || '.htaccess' == $file ) {
    37                 $real_file = get_home_path().$file;
     37                $real_file = get_home_path() . $file;
    3838        } else {
    39                 $real_file = ABSPATH.$file;
     39                $real_file = ABSPATH . $file;
    4040        }
    4141
    … …  
    257257                        if ( ! $fs->is_dir($to . $tmppath) )
    258258                                if ( !$fs->mkdir($to . $tmppath, 0755) )
    259                                         return new WP_Error('mkdir_failed', __('Could not create directory'));
     259                                        return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $tmppath);
    260260                }
    261261
    … …  
    263263                if ( ! $file['folder'] )
    264264                        if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
    265                                 return new WP_Error('copy_failed', __('Could not copy file'));
     265                                return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
    266266                        $fs->chmod($to . $file['filename'], 0644);
    267267        }
    … …  
    281281                if ( 'f' == $fileinfo['type'] ) {
    282282                        if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
    283                                 return false;
     283                                return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
    284284                        $wp_filesystem->chmod($to . $filename, 0644);
    285285                } elseif ( 'd' == $fileinfo['type'] ) {
    286286                        if ( !$wp_filesystem->mkdir($to . $filename, 0755) )
    287                                 return false;
    288                         if ( !copy_dir($from . $filename, $to . $filename) )
    289                                 return false;
     287                                return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
     288                        $result = copy_dir($from . $filename, $to . $filename);
     289                        if ( is_wp_error($result) )
     290                                return $result;
    290291                }
    291292        }
    292 
    293         return true;
    294293}
    295294
    296295function WP_Filesystem( $args = false ) {
    297296        global $wp_filesystem;
     297
     298        require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
    298299
    299300        $method = get_filesystem_method();
Note: See TracChangeset for help on using the changeset viewer.