ftp_base::mget() –

You appear to be a bot. Output may be restricted

Description

Usage

ftp_base::mget( $remote, $local, $continious );

Parameters

$remote
( mixed ) required
$local
( mixed ) optional default: . –
$continious
( mixed ) optional

Returns

void

Source

File name: wordpress/wp-admin/includes/class-ftp.php


Lines:

1 to 39 of 39
  function mget($remote, $local=".", $continious=false) {
    $list=$this->ftp_base::rawlist($remote, "-lA");
    if($list===false) {
      $this->ftp_base::PushError("mget","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents");
      return FALSE;
    }
    if(empty($list)) return true;
    if(!@file_exists($local)) {
      if(!@mkdir($local)) {
        $this->ftp_base::PushError("mget","cannot create local folder", "Cannot create folder \"".$local."\"");
        return FALSE;
      }
    }
    foreach($list as $k=>$v) {
      $list[$k]=$this->ftp_base::parselisting($v);
      if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]);
    }
    $ret=true;
    foreach($list as $el) {
      if($el["type"]=="d") {
        if(!$this->ftp_base::mget($remote."/".$el["name"], $local."/".$el["name"], $continious)) {
          $this->ftp_base::PushError("mget", "cannot copy folder", "Cannot copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
          $ret=false;
          if(!$continious) break;
        }
      } else {
        if(!$this->ftp_base::get($remote."/".$el["name"], $local."/".$el["name"])) {
          $this->ftp_base::PushError("mget", "cannot copy file", "Cannot copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
          $ret=false;
          if(!$continious) break;
        }
      }
      @chmod($local."/".$el["name"], $el["perms"]);
      $t=strtotime($el["date"]);
      if($t!==-1 and $t!==false) @touch($local."/".$el["name"], $t);
    }
    return $ret;
  }
 

 View on GitHub View on Trac