Make WordPress Core

Changeset 9117

Timestamp:
10/10/2008 10:02:46 AM (16 years ago)
Author:
azaozz
Message:

Fix for "Unable to locate WordPress directory" on core update and PHPDoc for class-wp-filesystem-base.php, props DD32, fixes #7861

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-base.php

    r8990 r9117  
    1313 */
    1414class WP_Filesystem_Base {
     15
     16
     17
     18
     19
     20
     21
    1522    var $verbose = false;
     23
     24
     25
     26
     27
     28
     29
    1630    var $cache = array();
    1731
     32
     33
     34
     35
     36
     37
     38
    1839    var $method = '';
    1940
     41
     42
     43
     44
     45
     46
     47
    2048    function abspath() {
    2149        if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false )
     
    2351        return $this->find_folder(ABSPATH);
    2452    }
     53
     54
     55
     56
     57
     58
     59
    2560    function wp_content_dir() {
    2661        if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false )
     
    2863        return $this->find_folder(WP_CONTENT_DIR);
    2964    }
     65
     66
     67
     68
     69
     70
     71
     72
    3073    function wp_plugins_dir() {
    3174        if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false )
     
    3376        return $this->find_folder(WP_PLUGIN_DIR);
    3477    }
     78
     79
     80
     81
     82
     83
     84
     85
    3586    function wp_themes_dir() {
    3687        return $this->wp_content_dir() . '/themes';
    3788    }
    38     //Back compat: use abspath() or wp_*_dir
     89   
     90    /**
     91     * Locates a folder on the remote filesystem.
     92     *
     93     * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
     94     *
     95     * @since 2.5
     96     * @deprecated 2.7
     97     * @access public
     98     *
     99     * @param string $base The folder to start searching from
     100     * @param bool $echo True to display debug information
     101     * @return string The location of the remote path.
     102     */
    39103    function find_base_dir($base = '.', $echo = false) {
     104
    40105        $this->verbose = $echo;
    41106        return $this->abspath();
    42107    }
    43     //Back compat: use ::abspath() or ::wp_*_dir
     108    /**
     109     * Locates a folder on the remote filesystem.
     110     *
     111     * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
     112     *
     113     * @since 2.5
     114     * @deprecated 2.7
     115     * @access public
     116     *
     117     * @param string $base The folder to start searching from
     118     * @param bool $echo True to display debug information
     119     * @return string The location of the remote path.
     120     */
    44121    function get_base_dir($base = '.', $echo = false) {
     122
    45123        $this->verbose = $echo;
    46124        return $this->abspath();
    47125    }
    48126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
    49139    function find_folder($folder) {
    50         $folder = str_replace('\\', '/', $folder); //Windows Sanitiation
     140
     141        $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
     142        $folder = str_replace('\\', '/', $folder); //Windows path sanitiation
     143
    51144        if ( isset($this->cache[ $folder ] ) )
    52145            return $this->cache[ $folder ];
     
    61154    }
    62155
    63     // Assumes $folder is windows sanitized;
    64     // Assumes that the drive letter is safe to be stripped off, Should not be a problem for windows servers.
     156    /**
     157     * Locates a folder on the remote filesystem.
     158     *
     159     * Expects Windows sanitized path
     160     *
     161     * @since 2.7
     162     * @access private
     163     *
     164     * @param string $folder the folder to locate
     165     * @param string $base the folder to start searching from
     166     * @param bool $loop if the function has recursed, Internal use only
     167     * @return string The location of the remote path.
     168     */
    65169    function search_for_folder($folder, $base = '.', $loop = false ) {
    66170        if ( empty( $base ) || '.' == $base )
    67171            $base = trailingslashit($this->cwd());
    68172
    69         $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
     173        $folder =
    70174
    71175        $folder_parts = explode('/', $folder);
     
    105209    }
    106210
    107     //Common Helper functions.
     211    /**
     212     * Returns the *nix style file permissions for a file
     213     *
     214     * From the PHP documentation page for fileperms()
     215     *
     216     * @link http://docs.php.net/fileperms
     217     * @since 2.5
     218     * @access public
     219     *
     220     * @param string $file string filename
     221     * @return int octal representation of permissions
     222     */
    108223    function gethchmod($file){
    109         //From the PHP.net page for ...?
    110224        $perms = $this->getchmod($file);
    111225        if (($perms & 0xC000) == 0xC000) // Socket
     
    148262        return $info;
    149263    }
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
    150278    function getnumchmodfromh($mode) {
    151         $realmode = "";
    152         $legal =  array("", "w", "r", "x", "-");
    153         $attarray = preg_split("//", $mode);
     279        $realmode = ;
     280        $legal =  array();
     281        $attarray = preg_split(, $mode);
    154282
    155283        for($i=0; $i < count($attarray); $i++)
     
    169297
    170298    /**
    171     * Determines if the string provided contains binary characters.
    172     *
    173     * @since 2.7
    174     * @package WordPress
    175     * @subpackage WP_Filesystem
    176     *
    177     * @param string $text String to test against
    178     *
    179     */
     299     * Determines if the string provided contains binary characters.
     300     *
     301     * @since 2.7
     302     * @access private
     303     *
     304     * @param string $text String to test against
     305     * @return bool true if string is binary, false otherwise
     306     */
    180307    function is_binary( $text ) {
    181308        return (bool) preg_match('|[^\x20-\x7E]|', $text); //chr(32)..chr(127)
Note: See TracChangeset for help on using the changeset viewer.