Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/4.0/src/wp-admin/includes/class-wp-filesystem-ssh2.php

    r31381 r31381  
    124124        }
    125125
    126         /**
    127          * @param string $command
    128          * @param bool $returnbool
    129          */
    130126        public function run_command( $command, $returnbool = false) {
    131127
    … …  
    149145        }
    150146
    151         /**
    152          * @param string $file
    153          * @return string|false
    154          */
    155147        public function get_contents( $file ) {
    156148                $file = ltrim($file, '/');
    … …  
    158150        }
    159151
    160         /**
    161          * @param string $file
    162          * @return array
    163          */
    164152        public function get_contents_array($file) {
    165153                $file = ltrim($file, '/');
    … …  
    167155        }
    168156
    169         /**
    170          * @param string $file
    171          * @param string $contents
    172          * @param bool|int $mode
    173          * @return bool
    174          */
    175157        public function put_contents($file, $contents, $mode = false ) {
    176158                $ret = file_put_contents( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ), $contents );
    … …  
    191173        }
    192174
    193         /**
    194          * @param string $dir
    195          * @return bool
    196          */
    197175        public function chdir($dir) {
    198176                return $this->run_command('cd ' . $dir, true);
    199177        }
    200178
    201         /**
    202          * @param string $file
    203          * @param string $group
    204          * @param bool $recursive
    205          */
    206179        public function chgrp($file, $group, $recursive = false ) {
    207180                if ( ! $this->exists($file) )
    … …  
    212185        }
    213186
    214         /**
    215          * @param string $file
    216          * @param int $mode
    217          * @param bool $recursive
    218          * @return bool
    219          */
    220187        public function chmod($file, $mode = false, $recursive = false) {
    221188                if ( ! $this->exists($file) )
    … …  
    241208         * @since Unknown
    242209         *
    243          * @param string     $file    Path to the file.
    244          * @param string|int $owner   A user name or number.
    245          * @param bool       $recursive Optional. If set True changes file owner recursivly. Defaults to False.
    246          * @return bool|string Returns true on success or false on failure.
     210         * @param string $file    Path to the file.
     211         * @param mixed $owner   A user name or number.
     212         * @param bool $recursive Optional. If set True changes file owner recursivly. Defaults to False.
     213         * @return bool Returns true on success or false on failure.
    247214         */
    248215        public function chown( $file, $owner, $recursive = false ) {
    … …  
    254221        }
    255222
    256         /**
    257          * @param string $file
    258          * @return string|false
    259          */
    260223        public function owner($file) {
    261224                $owneruid = @fileowner('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/'));
    … …  
    267230                return $ownerarray['name'];
    268231        }
    269         /**
    270          * @param string $file
    271          * @return string
    272          */
     232
    273233        public function getchmod($file) {
    274234                return substr( decoct( @fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ) ) ), -3 );
    275235        }
    276236
    277         /**
    278          * @param string $file
    279          * @return string|false
    280          */
    281237        public function group($file) {
    282238                $gid = @filegroup('ssh2.sftp://' . $this->sftp_link . '/' . ltrim($file, '/'));
    … …  
    289245        }
    290246
    291         /**
    292          * @param string $source
    293          * @param string $destination
    294          * @param bool $overwrite
    295          * @param int|bool $mode
    296          * @return bool
    297          */
    298247        public function copy($source, $destination, $overwrite = false, $mode = false) {
    299248                if ( ! $overwrite && $this->exists($destination) )
    … …  
    305254        }
    306255
    307         /**
    308          * @param string $source
    309          * @param string $destination
    310          * @param bool $overwrite
    311          * @return bool
    312          */
    313256        public function move($source, $destination, $overwrite = false) {
    314                 return @ssh2_sftp_rename( $this->sftp_link, $source, $destination );
    315         }
    316 
    317         /**
    318          * @param string $file
    319          * @param bool $recursive
    320          * @param string|bool $type
    321          * @return bool
    322          */
     257                return @ssh2_sftp_rename($this->link, $source, $destination);
     258        }
     259
    323260        public function delete($file, $recursive = false, $type = false) {
    324261                if ( 'f' == $type || $this->is_file($file) )
    … …  
    335272        }
    336273
    337         /**
    338          * @param string $file
    339          * @return bool
    340          */
    341274        public function exists($file) {
    342275                $file = ltrim($file, '/');
    343276                return file_exists('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    344277        }
    345         /**
    346          * @param string $file
    347          * @return bool
    348          */
     278
    349279        public function is_file($file) {
    350280                $file = ltrim($file, '/');
    351281                return is_file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    352282        }
    353         /**
    354          * @param string $path
    355          * @return bool
    356          */
     283
    357284        public function is_dir($path) {
    358285                $path = ltrim($path, '/');
    359286                return is_dir('ssh2.sftp://' . $this->sftp_link . '/' . $path);
    360287        }
    361         /**
    362          * @param string $file
    363          * @return bool
    364          */
     288
    365289        public function is_readable($file) {
    366290                $file = ltrim($file, '/');
    367291                return is_readable('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    368292        }
    369         /**
    370          * @param string $file
    371          * @return bool
    372          */
     293
    373294        public function is_writable($file) {
    374295                $file = ltrim($file, '/');
    375296                return is_writable('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    376297        }
    377         /**
    378          * @param string $file
    379          * @return int
    380          */
     298
    381299        public function atime($file) {
    382300                $file = ltrim($file, '/');
    … …  
    384302        }
    385303
    386         /**
    387          * @param string $file
    388          * @return int
    389          */
    390304        public function mtime($file) {
    391305                $file = ltrim($file, '/');
    … …  
    393307        }
    394308
    395         /**
    396          * @param string $file
    397          * @return int
    398          */
    399309        public function size($file) {
    400310                $file = ltrim($file, '/');
    … …  
    402312        }
    403313
    404         /**
    405          * @param string $file
    406          * @param int $time
    407          * @param int $atime
    408          */
    409314        public function touch($file, $time = 0, $atime = 0) {
    410315                //Not implemented.
    411316        }
    412317
    413         /**
    414          * @param string $path
    415          * @param mixed $chmod
    416          * @param mixed $chown
    417          * @param mixed $chgrp
    418          * @return bool
    419          */
    420318        public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
    421319                $path = untrailingslashit($path);
    … …  
    434332        }
    435333
    436         /**
    437          * @param string $path
    438          * @param bool $recursive
    439          * @return bool
    440          */
    441334        public function rmdir($path, $recursive = false) {
    442335                return $this->delete($path, $recursive);
    443336        }
    444337
    445         /**
    446          * @param string $path
    447          * @param bool $include_hidden
    448          * @param bool $recursive
    449          * @return bool|array
    450          */
    451338        public function dirlist($path, $include_hidden = true, $recursive = false) {
    452339                if ( $this->is_file($path) ) {
Note: See TracChangeset for help on using the changeset viewer.