Make WordPress Core


Ignore:
Timestamp:
03/01/2008 09:20:23 PM (19 years ago)
Author:
ryan
Message:

Plugin updater updates. see #5586

File:
1 edited

Legend:

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

    r7058 r7126  
    238238        $tmppath = '';
    239239        for ( $j = 0; $j < count($path) - 1; $j++ ) {
     240                $prevpath = $tmppath;
    240241                $tmppath .= $path[$j] . '/';
    241242                if ( ! $fs->is_dir($tmppath) ) {
    242                         $fs->mkdir($tmppath);
    243                 } else {
    244                         $fs->setDefaultPermissions( $fs->getchmod($tmppath) );
     243                        //$fs->setDefaultPermissions( $fs->getchmod($tmppath) );
     244                        $fs->mkdir($tmppath, 0755);
    245245                }
    246246        }
     
    254254                        $tmppath .= $path[$j] . '/';
    255255                        if ( ! $fs->is_dir($to . $tmppath) )
    256                                 $fs->mkdir($to . $tmppath);
     256                                if ( !$fs->mkdir($to . $tmppath, 0755) )
     257                                        return new WP_Error('mkdir_failed', __('Could not create directory'));
    257258                }
    258259
    259260                // We've made sure the folders are there, so let's extract the file now:
    260261                if ( ! $file['folder'] )
    261                         $fs->put_contents( $to . $file['filename'], $file['content']);
    262         }
     262                        if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
     263                                return new WP_Error('copy_failed', __('Could not copy file'));
     264                        $fs->chmod($to . $file['filename'], 0644);
     265        }
     266
     267        return true;
    263268}
    264269
     
    272277
    273278        foreach ( (array) $dirlist as $filename => $fileinfo ) {
    274                 if ( 'file' == $fileinfo['type'] ) {
    275                         $wp_filesystem->copy($from . $filename, $to . $filename, true);
    276                 } elseif ( 'folder' == $fileinfo['type'] ) {
    277                         $wp_filesystem->mkdir($to . $filename);
    278                         copy_dir($from . $filename, $to . $filename);
     279                if ( 'f' == $fileinfo['type'] ) {
     280                        if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
     281                                return false;
     282                        $wp_filesystem->chmod($to . $filename, 0644);
     283                } elseif ( 'd' == $fileinfo['type'] ) {
     284                        if ( !$wp_filesystem->mkdir($to . $filename, 0755) )
     285                                return false;
     286                        if ( !copy_dir($from . $filename, $to . $filename) )
     287                                return false;
    279288                }
    280289        }
     290
     291        return true;
    281292}
    282293
     
    303314
    304315function get_filesystem_method() {
     316        return 'ftpsockets';
     317
    305318        $tempFile = tempnam(get_temp_dir(), 'WPU');
    306319
    307320        if ( getmyuid() == fileowner($tempFile) ) {
    308321                unlink($tempFile);
    309                 //return 'direct';
     322                return 'direct';
    310323        } else {
    311324                unlink($tempFile);
Note: See TracChangeset for help on using the changeset viewer.