Changeset 10919 for trunk/wp-admin/includes/class-wp-filesystem-base.php
- Timestamp:
- 04/13/2009 04:11:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-filesystem-base.php
r10150 r10919 47 47 */ 48 48 function abspath() { 49 if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false )50 return FTP_BASE;51 49 $folder = $this->find_folder(ABSPATH); 52 50 //Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare. … … 63 61 */ 64 62 function wp_content_dir() { 65 if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false )66 return FTP_CONTENT_DIR;67 63 return $this->find_folder(WP_CONTENT_DIR); 68 64 } … … 76 72 */ 77 73 function wp_plugins_dir() { 78 if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false )79 return FTP_PLUGIN_DIR;80 74 return $this->find_folder(WP_PLUGIN_DIR); 81 75 } … … 143 137 function find_folder($folder) { 144 138 139 if ( strpos($this->method, 'ftp') !== false ) { 140 $constant_overrides = array( 'FTP_BASE' => ABSPATH, 'FTP_CONTENT_DIR' => WP_CONTENT_DIR, 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR ); 141 foreach ( $constant_overrides as $constant => $dir ) 142 if ( defined($constant) && $folder === $dir ) 143 return trailingslashit(constant($constant)); 144 } elseif ( 'direct' == $this->method ) { 145 return trailingslashit($folder); 146 } 147 145 148 $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there. 146 149 $folder = str_replace('\\', '/', $folder); //Windows path sanitiation … … 150 153 151 154 if ( $this->exists($folder) ) { //Folder exists at that absolute path. 155 $folder = trailingslashit($folder); 152 156 $this->cache[ $folder ] = $folder; 153 157 return $folder; … … 190 194 // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on. 191 195 // If it reaches the end, and still cant find it, it'll return false for the entire function. 192 if ( isset($files[ $key ]) ){196 if ( isset($files[ $key ]) ){ 193 197 //Lets try that folder: 194 198 $newdir = trailingslashit(path_join($base, $key)); 195 if ( $this->verbose )199 if ( $this->verbose ) 196 200 printf( __('Changing to %s') . '<br/>', $newdir ); 197 if ( $ret = $this->search_for_folder( $folder, $newdir, $loop) )201 if ( $ret = $this->search_for_folder( $folder, $newdir, $loop) ) 198 202 return $ret; 199 203 } … … 201 205 202 206 //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take. 203 if (isset( $files[ $last_path ] ) ) {204 if ( $this->verbose )207 if (isset( $files[ $last_path ] ) ) { 208 if ( $this->verbose ) 205 209 printf( __('Found %s') . '<br/>', $base . $last_path ); 206 return $base . $last_path;210 return trailingslashit($base . $last_path); 207 211 } 208 if ( $loop )212 if ( $loop ) 209 213 return false;//Prevent tihs function looping again. 210 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.
Note: See TracChangeset
for help on using the changeset viewer.