Changeset 8600 for trunk/wp-admin/includes/class-wp-filesystem-base.php
- Timestamp:
- 08/09/2008 05:36:14 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-filesystem-base.php
r8255 r8600 3 3 var $verbose = false; 4 4 var $cache = array(); 5 5 6 6 var $method = ''; 7 7 8 8 function abspath() { 9 if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false ) 9 if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false ) 10 10 return FTP_BASE; 11 11 return $this->find_folder(ABSPATH); 12 12 } 13 13 function wp_content_dir() { 14 if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false ) 14 if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false ) 15 15 return FTP_CONTENT_DIR; 16 16 return $this->find_folder(WP_CONTENT_DIR); 17 17 } 18 18 function wp_plugins_dir() { 19 if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false ) 19 if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false ) 20 20 return FTP_PLUGIN_DIR; 21 21 return $this->find_folder(WP_PLUGIN_DIR); … … 34 34 return $this->abspath(); 35 35 } 36 36 37 37 function find_folder($folder) { 38 38 $folder = str_replace('\\', '/', $folder); //Windows Sanitiation … … 48 48 return $return; 49 49 } 50 50 51 51 // Assumes $folder is windows sanitized; 52 52 // Assumes that the drive letter is safe to be stripped off, Should not be a problem for windows servers. … … 54 54 if ( empty( $base ) || '.' == $base ) 55 55 $base = trailingslashit($this->cwd()); 56 56 57 57 $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there. 58 58 59 59 $folder_parts = explode('/', $folder); 60 60 $last_path = $folder_parts[ count($folder_parts) - 1 ]; 61 61 62 62 $files = $this->dirlist( $base ); 63 63 64 64 foreach ( $folder_parts as $key ) { 65 65 if ( $key == $last_path ) 66 66 continue; //We want this to be caught by the next code block. 67 67 68 //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 69 // If its found, change into it and follow through looking for it. 68 //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 69 // If its found, change into it and follow through looking for it. 70 70 // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on. 71 71 // If it reaches the end, and still cant find it, it'll return false for the entire function. … … 79 79 } 80 80 } 81 81 82 82 //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. 83 83 if(isset( $files[ $last_path ] ) ) { … … 89 89 return false;//Prevent tihs function looping again. 90 90 //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. 91 return $this->search_for_folder($folder, '/', true); 92 91 return $this->search_for_folder($folder, '/', true); 92 93 93 } 94 94 95 95 //Common Helper functions. 96 96 function gethchmod($file){ … … 144 144 if($key = array_search($attarray[$i], $legal)) 145 145 $realmode .= $legal[$key]; 146 146 147 147 $mode = str_pad($realmode, 9, '-'); 148 148 $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1'); 149 149 $mode = strtr($mode,$trans); 150 150 151 151 $newmode = ''; 152 152 $newmode .= $mode[0] + $mode[1] + $mode[2];
Note: See TracChangeset
for help on using the changeset viewer.