WordPress.org

Make WordPress Core

Changeset 10050


Ignore:
Timestamp:
12/04/08 21:58:46 (6 years ago)
Author:
ryan
Message:

Allow override of default file permissions with FS_CHMOD_DIR and FS_CHMOD_FILE. Props DD32. see #8478

Location:
trunk/wp-admin/includes
Files:
3 edited

Legend:

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

    r10048 r10050  
    499499            for ( $i = $i + 1; $i <= count($path); $i++ ) { 
    500500                $tmppath = implode('/', array_slice($path, 0, $i) ); 
    501                 if ( ! $fs->mkdir($tmppath, 0755) ) 
     501                if ( ! $fs->mkdir($tmppath, FS_CHMOD_DIR) ) 
    502502                    return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath); 
    503503            } 
     
    517517                for ( $i = $i + 1; $i <= count($path); $i++ ) { //< count() no file component please. 
    518518                    $tmppath = $to . implode('/', array_slice($path, 0, $i) ); 
    519                     if ( ! $fs->is_dir($tmppath) && ! $fs->mkdir($tmppath, 0755) ) 
     519                    if ( ! $fs->is_dir($tmppath) && ! $fs->mkdir($tmppath, FS_CHMOD_DIR) ) 
    520520                        return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath); 
    521521                } 
     
    528528            if ( !$fs->put_contents( $to . $file['filename'], $file['content']) ) 
    529529                return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']); 
    530             $fs->chmod($to . $file['filename'], 0644); 
     530            $fs->chmod($to . $file['filename'], FS_CHMOD_FILE); 
    531531        } 
    532532    } 
     
    559559                    return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename); 
    560560            } 
    561             $wp_filesystem->chmod($to . $filename, 0644); 
     561            $wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE); 
    562562        } elseif ( 'd' == $fileinfo['type'] ) { 
    563563            if ( !$wp_filesystem->is_dir($to . $filename) ) { 
    564                 if ( !$wp_filesystem->mkdir($to . $filename, 0755) ) 
     564                if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) 
    565565                    return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename); 
    566566            } 
     
    604604    if ( !$wp_filesystem->connect() ) 
    605605        return false; //There was an erorr connecting to the server. 
     606 
     607    // Set the permission constants if not already set. 
     608    if ( ! defined('FS_CHMOD_DIR') ) 
     609        define('FS_CHMOD_DIR', 0755 ); 
     610    if ( ! defined('FS_CHMOD_FILE') ) 
     611        define('FS_CHMOD_FILE', 0644 ); 
    606612 
    607613    return true; 
  • trunk/wp-admin/includes/update-core.php

    r9985 r10050  
    228228    $maintenance_file = $to . '.maintenance'; 
    229229    $wp_filesystem->delete($maintenance_file); 
    230     $wp_filesystem->put_contents($maintenance_file, $maintenance_string, 0644); 
     230    $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); 
    231231 
    232232    // Copy new versions of WP files into place. 
  • trunk/wp-admin/includes/update.php

    r9719 r10050  
    469469        return new WP_Error('copy_failed', __('Could not copy files')); 
    470470    } 
    471     $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', 0644); 
     471    $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE); 
    472472 
    473473    require(ABSPATH . 'wp-admin/includes/update-core.php'); 
Note: See TracChangeset for help on using the changeset viewer.