Ticket #8478: 8478.diff
File 8478.diff, 7.4 KB (added by , 16 years ago) |
---|
-
wp-admin/includes/class-wp-filesystem-direct.php
104 104 return $ownerarray['name']; 105 105 } 106 106 function getchmod($file) { 107 return @fileperms($file);107 return substr(decoct(@fileperms($file)),3); 108 108 } 109 109 function group($file) { 110 110 $gid = @filegroup($file); -
wp-admin/includes/class-wp-filesystem-ftpext.php
169 169 } 170 170 function getchmod($file) { 171 171 $dir = $this->dirlist($file); 172 return $ dir[$file]['permsn'];172 return $this->getnumchmodfromh( $dir[basename($file)]['perms'] ); 173 173 } 174 174 function group($file) { 175 175 $dir = $this->dirlist($file); … … 321 321 } 322 322 323 323 function dirlist($path = '.', $incdot = false, $recursive = false) { 324 if( $this->is_file($path) ) { 325 $limitFile = basename($path); 326 $path = dirname($path) . '/'; 324 325 if ( substr($path, -1) !== '/') { 326 $limit = basename($path); 327 $path = trailingslashit(dirname($path)); 327 328 } else { 328 $limit File= false;329 $limit = false; 329 330 } 330 331 331 332 $list = @ftp_rawlist($this->link, '-a ' . $path, false); … … 339 340 if ( empty($entry) ) 340 341 continue; 341 342 342 if ( '.' == $entry[ "name"] || '..' == $entry["name"] )343 if ( '.' == $entry['name'] || '..' == $entry['name'] ) 343 344 continue; 344 345 346 if ( $limit && $entry['name'] != $limit ) 347 continue; 348 345 349 $dirlist[ $entry['name'] ] = $entry; 346 350 } 347 351 -
wp-admin/includes/class-wp-filesystem-ftpsockets.php
186 186 187 187 function getchmod($file) { 188 188 $dir = $this->dirlist($file); 189 return $ dir[$file]['permsn'];189 return $this->getnumchmodfromh( $dir[basename($file)]['perms'] ); 190 190 } 191 191 192 192 function group($file) { … … 281 281 } 282 282 283 283 function dirlist($path = '.', $incdot = false, $recursive = false ) { 284 if( $this->is_file($path) ) { 285 $limitFile = basename($path); 286 $path = dirname($path) . '/'; 284 285 if ( substr($path, -1) !== '/') { 286 $limit = basename($path); 287 $path = trailingslashit(dirname($path)); 287 288 } else { 288 $limit File= false;289 $limit = false; 289 290 } 290 291 291 292 $list = $this->ftp->dirlist($path); 292 293 if( ! $list ) 293 294 return false; 295 294 296 if( empty($list) ) 295 297 return array(); 296 298 297 299 $ret = array(); 298 300 foreach ( $list as $struc ) { 301 if ( $limit && $struc['name'] != $limit ) 302 continue; 299 303 300 304 if ( 'd' == $struc['type'] ) { 301 305 $struc['files'] = array(); -
wp-admin/includes/class-wp-filesystem-ssh2.php
270 291 function getchmod($file) { 271 292 $this->debug("getchmod();"); 272 293 $dir = $this->dirlist($file); 273 return $ dir[$file]['permsn'];294 return $this->getnumchmodfromh( $dir[basename($file)]['perms'] ); 274 295 } 275 296 276 297 function group($file) { -
wp-admin/includes/file.php
498 498 if ( $fs->is_dir($tmppath) ) { //Found the highest folder that exists, Create from here(ie +1) 499 499 for ( $i = $i + 1; $i <= count($path); $i++ ) { 500 500 $tmppath = implode('/', array_slice($path, 0, $i) ); 501 if ( ! $fs->mkdir($tmppath, 0755) )501 if ( ! $fs->mkdir($tmppath, FS_CHMOD_DIR) ) 502 502 return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath); 503 503 } 504 504 break; //Exit main for loop … … 516 516 if ( $fs->is_dir($tmppath) ) {//Found the highest folder that exists, Create from here 517 517 for ( $i = $i + 1; $i <= count($path); $i++ ) { //< count() no file component please. 518 518 $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) ) 520 520 return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath); 521 521 } 522 522 break; //Exit main for loop … … 527 527 if ( ! $file['folder'] ) { 528 528 if ( !$fs->put_contents( $to . $file['filename'], $file['content']) ) 529 529 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); 531 531 } 532 532 } 533 533 return true; … … 558 558 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) 559 559 return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename); 560 560 } 561 $wp_filesystem->chmod($to . $filename, 0644);561 $wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE); 562 562 } elseif ( 'd' == $fileinfo['type'] ) { 563 563 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) ) 565 565 return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename); 566 566 } 567 567 $result = copy_dir($from . $filename, $to . $filename); … … 604 604 if ( !$wp_filesystem->connect() ) 605 605 return false; //There was an erorr connecting to the server. 606 606 607 //Set the Permission constants if not allready set. 608 if ( ! defined('FS_CHMOD_DIR') || ! defined('FS_CHMOD_FILE') ) { 609 $path = $wp_filesystem->abspath(); 610 611 if ( ! defined('FS_CHMOD_DIR') ) 612 define('FS_CHMOD_DIR', octdec($wp_filesystem->getchmod($path . 'wp-includes')) ); 613 if ( ! defined('FS_CHMOD_FILE') ) 614 define('FS_CHMOD_FILE', octdec($wp_filesystem->getchmod($path . 'wp-settings.php')) ); 615 } 616 607 617 return true; 608 618 } 609 619 -
wp-admin/includes/update-core.php
227 227 $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; 228 228 $maintenance_file = $to . '.maintenance'; 229 229 $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); 231 231 232 232 // Copy new versions of WP files into place. 233 233 $result = copy_dir($from . '/wordpress', $to); -
wp-admin/includes/update.php
468 468 $wp_filesystem->delete($working_dir, true); 469 469 return new WP_Error('copy_failed', __('Could not copy files')); 470 470 } 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); 472 472 473 473 require(ABSPATH . 'wp-admin/includes/update-core.php'); 474 474