Ticket #23845: wp-filesystem-ftpext.patch
File wp-filesystem-ftpext.patch, 1.4 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/class-wp-filesystem-ftpext.php
47 47 48 48 if ( ! empty($opt['base']) ) 49 49 $this->wp_base = $opt['base']; 50 elseif (defined('FTP_BASE')) 51 $this->wp_base = trailingslashit(FTP_BASE); 52 53 50 54 51 55 // Check if the options provided are OK. 52 56 if ( empty($opt['username']) ) … … 84 88 @ftp_pasv( $this->link, true ); 85 89 if ( @ftp_get_option($this->link, FTP_TIMEOUT_SEC) < FS_TIMEOUT ) 86 90 @ftp_set_option($this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT); 87 91 92 if(isset($this->wp_base)) 93 $this->chdir($this->wp_base); 88 94 return true; 89 95 } 90 96 … … 140 146 $cwd = trailingslashit($cwd); 141 147 return $cwd; 142 148 } 149 150 function strict_wp_base($dir) { 151 if($this->wp_base) { 152 $_dir = trailingslashit($dir); 153 if(substr($_dir,0,strlen($this->base))!=$this->wp_base) { 154 if(substr($dir,0,1)!='/') { 155 //make absolute path if is not 156 $cwd = trailingslashit($this->cwd()); 157 $_dir = trailingslashit($cwd.$dir); 158 } 159 if(substr($_dir,0,strlen($this->wp_base))!=$this->wp_base) { 160 //if directory doesn't contain in wp_base, add force it 161 $dir = $this->wp_base.$_dir; 162 } 163 } 164 } 165 return $dir; 166 } 167 143 168 function chdir($dir) { 169 $dir = $this->strict_wp_base($dir); 144 170 return @ftp_chdir($this->link, $dir); 145 171 } 146 172 function chgrp($file, $group, $recursive = false ) {