Make WordPress Core


Ignore:
Timestamp:
12/01/2014 12:12:05 AM (10 years ago)
Author:
wonderboymusic
Message:

Improve various @param docs for src/wp-admin/includes/class-wp-filesystem-*.php.

See #30224.

File:
1 edited

Legend:

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

    r28489 r30678  
    8888    }
    8989
     90    /**
     91     * @param string $file
     92     * @return bool|string
     93     */
    9094    public function get_contents( $file ) {
    9195        $tempfile = wp_tempnam($file);
     
    109113    }
    110114
     115    /**
     116     * @param string $file
     117     * @return array
     118     */
    111119    public function get_contents_array($file) {
    112120        return explode("\n", $this->get_contents($file));
    113121    }
    114122
     123    /**
     124     * @param string $file
     125     * @param string $contents
     126     * @param bool|string $mode
     127     * @return bool
     128     */
    115129    public function put_contents($file, $contents, $mode = false ) {
    116130        $tempfile = wp_tempnam($file);
     
    144158    }
    145159
     160    /**
     161     * @return string
     162     */
    146163    public function cwd() {
    147164        $cwd = @ftp_pwd($this->link);
     
    151168    }
    152169
     170    /**
     171     * @param string $dir
     172     * @return bool
     173     */
    153174    public function chdir($dir) {
    154175        return @ftp_chdir($this->link, $dir);
    155176    }
    156177
     178    /**
     179     * @param string $file
     180     * @param bool $group
     181     * @param bool $recursive
     182     */
    157183    public function chgrp($file, $group, $recursive = false ) {
    158184        return false;
    159185    }
    160186
     187    /**
     188     * @param string $file
     189     * @param int $mode
     190     * @param bool $recursive
     191     * @return bool
     192     */
    161193    public function chmod($file, $mode = false, $recursive = false) {
    162194        if ( ! $mode ) {
     
    182214    }
    183215
     216    /**
     217     * @param string $file
     218     * @return string
     219     */
    184220    public function owner($file) {
    185221        $dir = $this->dirlist($file);
    186222        return $dir[$file]['owner'];
    187223    }
    188 
     224    /**
     225     * @param string $file
     226     * @return string
     227     */
    189228    public function getchmod($file) {
    190229        $dir = $this->dirlist($file);
    191230        return $dir[$file]['permsn'];
    192231    }
    193 
     232    /**
     233     * @param string $file
     234     * @return string
     235     */
    194236    public function group($file) {
    195237        $dir = $this->dirlist($file);
     
    197239    }
    198240
     241    /**
     242     *
     243     * @param string $source
     244     * @param string $destination
     245     * @param bool   $overwrite
     246     * @param string|bool $mode
     247     * @return bool
     248     */
    199249    public function copy($source, $destination, $overwrite = false, $mode = false) {
    200250        if ( ! $overwrite && $this->exists($destination) )
     
    205255        return $this->put_contents($destination, $content, $mode);
    206256    }
    207 
     257    /**
     258     * @param string $source
     259     * @param string $destination
     260     * @param bool $overwrite
     261     * @return bool
     262     */
    208263    public function move($source, $destination, $overwrite = false) {
    209264        return ftp_rename($this->link, $source, $destination);
    210265    }
    211 
     266    /**
     267     * @param string $file
     268     * @param bool $recursive
     269     * @param string $type
     270     * @return bool
     271     */
    212272    public function delete($file, $recursive = false, $type = false) {
    213273        if ( empty($file) )
     
    224284        return @ftp_rmdir($this->link, $file);
    225285    }
    226 
     286    /**
     287     * @param string $file
     288     * @return bool
     289     */
    227290    public function exists($file) {
    228291        $list = @ftp_nlist($this->link, $file);
    229292        return !empty($list); //empty list = no file, so invert.
    230293    }
    231 
     294    /**
     295     * @param string $file
     296     * @return bool
     297     */
    232298    public function is_file($file) {
    233299        return $this->exists($file) && !$this->is_dir($file);
    234300    }
    235 
     301    /**
     302     * @param string $path
     303     * @return bool
     304     */
    236305    public function is_dir($path) {
    237306        $cwd = $this->cwd();
     
    244313    }
    245314
     315    /**
     316     * @param string $file
     317     * @return bool
     318     */
    246319    public function is_readable($file) {
    247320        return true;
    248321    }
    249 
     322    /**
     323     * @param string $file
     324     * @return bool
     325     */
    250326    public function is_writable($file) {
    251327        return true;
    252328    }
    253 
     329    /**
     330     * @param string $file
     331     * @return bool
     332     */
    254333    public function atime($file) {
    255334        return false;
    256335    }
    257 
     336    /**
     337     * @param string $file
     338     * @return int
     339     */
    258340    public function mtime($file) {
    259341        return ftp_mdtm($this->link, $file);
    260342    }
    261 
     343    /**
     344     * @param string $file
     345     * @return int
     346     */
    262347    public function size($file) {
    263348        return ftp_size($this->link, $file);
    264349    }
    265 
     350    /**
     351     * @param string $file
     352     * @return bool
     353     */
    266354    public function touch($file, $time = 0, $atime = 0) {
    267355        return false;
    268356    }
    269357
     358    /**
     359     * @param string $path
     360     * @param mixed $chmod
     361     * @param mixed $chown
     362     * @param mixed $chgrp
     363     * @return bool
     364     */
    270365    public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
    271366        $path = untrailingslashit($path);
     
    283378    }
    284379
     380    /**
     381     * @param string $path
     382     * @param bool $recursive
     383     * @return bool
     384     */
    285385    public function rmdir($path, $recursive = false) {
    286386        return $this->delete($path, $recursive);
    287387    }
    288388
     389    /**
     390     * @staticvar bool $is_windows
     391     * @param string $line
     392     * @return string
     393     */
    289394    public function parselisting($line) {
    290395        static $is_windows;
     
    360465    }
    361466
     467    /**
     468     * @param string $path
     469     * @param bool $include_hidden
     470     * @param bool $recursive
     471     * @return bool|array
     472     */
    362473    public function dirlist($path = '.', $include_hidden = true, $recursive = false) {
    363474        if ( $this->is_file($path) ) {
Note: See TracChangeset for help on using the changeset viewer.