Ticket #10170: 10170.diff
File 10170.diff, 6.7 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/class-wp-filesystem-base.php
210 210 return trailingslashit($base . $last_path); 211 211 } 212 212 if ( $loop ) 213 return false; //Prevent tihs function looping again.213 return false; //Prevent tihs function looping again. 214 214 //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups. 215 215 return $this->search_for_folder($folder, '/', true); 216 216 … … 242 242 $info = 'd'; 243 243 elseif (($perms & 0x2000) == 0x2000) // Character special 244 244 $info = 'c'; 245 elseif (($perms & 0x1000) == 0x1000) // FIFO pipe245 elseif (($perms & 0x1000) == 0x1000) // FIFO pipe 246 246 $info = 'p'; 247 247 else // Unknown 248 248 $info = 'u'; -
wp-admin/includes/class-wp-filesystem-direct.php
15 15 * @uses WP_Filesystem_Base Extends class 16 16 */ 17 17 class WP_Filesystem_Direct extends WP_Filesystem_Base { 18 var $permission = null;19 18 var $errors = null; 20 19 function WP_Filesystem_Direct($arg) { 21 20 $this->method = 'direct'; 22 21 $this->errors = new WP_Error(); 23 $this->permission = umask();24 22 } 25 23 function connect() { 26 24 return true; 27 25 } 28 function setDefaultPermissions($perm) {29 $this->permission = $perm;30 }31 26 function get_contents($file) { 32 27 return @file_get_contents($file); 33 28 } … … 63 58 64 59 return true; 65 60 } 66 function chmod($file, $mode = false, $recursive = false) { 67 if ( ! $mode ) 68 $mode = $this->permission; 61 function chmod($file, $mode, $recursive = false) { 69 62 if ( ! $this->exists($file) ) 70 63 return false; 71 64 if ( ! $recursive ) 72 return @chmod($file, $mode);65 return @chmod($file, $mode); 73 66 if ( ! $this->is_dir($file) ) 74 67 return @chmod($file, $mode); 75 68 //Is a directory, and we want recursive … … 198 191 199 192 function mkdir($path, $chmod = false, $chown = false, $chgrp = false){ 200 193 if ( ! $chmod) 201 $chmod = $this->permission;194 $chmod = FS_CHMOD_DIR; 202 195 203 196 if ( ! @mkdir($path, $chmod) ) 204 197 return false; 198 chmod($path, $chmod); 205 199 if ( $chown ) 206 200 $this->chown($path, $chown); 207 201 if ( $chgrp ) -
wp-admin/includes/class-wp-filesystem-ftpext.php
20 20 var $errors = null; 21 21 var $options = array(); 22 22 23 var $permission = null;24 25 23 function WP_Filesystem_FTPext($opt='') { 26 24 $this->method = 'ftpext'; 27 25 $this->errors = new WP_Error(); … … 84 82 return true; 85 83 } 86 84 87 function setDefaultPermissions($perm) {88 $this->permission = $perm;89 }90 91 85 function get_contents($file, $type = '', $resumepos = 0 ){ 92 86 if( empty($type) ) 93 87 $type = FTP_BINARY; … … 139 133 function chgrp($file, $group, $recursive = false ) { 140 134 return false; 141 135 } 142 function chmod($file, $mode = false, $recursive = false) { 143 if( ! $mode ) 144 $mode = $this->permission; 145 if( ! $mode ) 146 return false; 136 function chmod($file, $mode, $recursive = false) { 147 137 if ( ! $this->exists($file) && ! $this->is_dir($file) ) 148 138 return false; 149 139 if ( ! $recursive || ! $this->is_dir($file) ) { … … 153 143 } 154 144 //Is a directory, and we want recursive 155 145 $filelist = $this->dirlist($file); 156 foreach ($filelist as $filename){146 foreach ( $filelist as $filename){ 157 147 $this->chmod($file . '/' . $filename, $mode, $recursive); 158 148 } 159 149 return true; -
wp-admin/includes/class-wp-filesystem-ftpsockets.php
20 20 var $errors = null; 21 21 var $options = array(); 22 22 23 var $permission = null;24 25 23 function WP_Filesystem_ftpsockets($opt = '') { 26 24 $this->method = 'ftpsockets'; 27 25 $this->errors = new WP_Error(); … … 82 80 return true; 83 81 } 84 82 85 function setDefaultPermissions($perm) {86 $this->permission = $perm;87 }88 89 83 function get_contents($file, $type = '', $resumepos = 0) { 90 84 if( ! $this->exists($file) ) 91 85 return false; … … 157 151 return false; 158 152 } 159 153 160 function chmod($file, $mode = false, $recursive = false ) { 161 if( ! $mode ) 162 $mode = $this->permission; 163 if( ! $mode ) 164 return false; 154 function chmod($file, $mode, $recursive = false ) { 165 155 //if( ! $this->exists($file) ) 166 156 // return false; 167 157 if( ! $recursive || ! $this->is_dir($file) ) { 168 return $this->ftp->chmod($file, $mode);158 return $this->ftp->chmod($file, $mode); 169 159 } 170 160 //Is a directory, and we want recursive 171 161 $filelist = $this->dirlist($file); -
wp-admin/includes/class-wp-filesystem-ssh2.php
56 56 var $errors = array(); 57 57 var $options = array(); 58 58 59 var $permission = 0644;60 61 59 function WP_Filesystem_SSH2($opt='') { 62 60 $this->method = 'ssh2'; 63 61 $this->errors = new WP_Error(); … … 160 158 return false; 161 159 } 162 160 163 function setDefaultPermissions($perm) {164 $this->debug("setDefaultPermissions();");165 if ( $perm )166 $this->permission = $perm;167 }168 169 161 function get_contents($file, $type = '', $resumepos = 0 ) { 170 162 $file = ltrim($file, '/'); 171 163 return file_get_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file); … … 200 192 return $this->run_command(sprintf('chgrp -R %o %s', $mode, escapeshellarg($file)), true); 201 193 } 202 194 203 function chmod($file, $mode = false, $recursive = false) { 204 if( ! $mode ) 205 $mode = $this->permission; 206 if( ! $mode ) 207 return false; 195 function chmod($file, $mode, $recursive = false) { 208 196 if ( ! $this->exists($file) ) 209 197 return false; 210 198 if ( ! $recursive || ! $this->is_dir($file) ) … … 315 303 //Not implmented. 316 304 } 317 305 318 function mkdir($path, $chmod = null, $chown = false, $chgrp = false) {306 function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 319 307 $path = untrailingslashit($path); 320 $chmod = !empty($chmod) ? $chmod : $this->permission; 308 if ( ! $chmod ) 309 $chmod = FS_CHMOD_DIR; 321 310 if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) ) 322 311 return false; 323 312 if ( $chown )