ftp_base::mput()publicWP 1.0

Метод класса: ftp_base{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ftp_base = new ftp_base();
$ftp_base->mput( $local, $remote, $continious );
$local **
-
По умолчанию: "."
$remote **
-
По умолчанию: NULL
$continious **
-
По умолчанию: false

Код ftp_base::mput() WP 6.5.2

function mput($local=".", $remote=NULL, $continious=false) {
	$local=realpath($local);
	if(!@file_exists($local)) {
		$this->PushError("mput","cannot open local folder", "Cannot stat folder \"".$local."\"");
		return FALSE;
	}
	if(!is_dir($local)) return $this->put($local, $remote);
	if(empty($remote)) $remote=".";
	elseif(!$this->file_exists($remote) and !$this->mkdir($remote)) return FALSE;
	if($handle = opendir($local)) {
		$list=array();
		while (false !== ($file = readdir($handle))) {
			if ($file != "." && $file != "..") $list[]=$file;
		}
		closedir($handle);
	} else {
		$this->PushError("mput","cannot open local folder", "Cannot read folder \"".$local."\"");
		return FALSE;
	}
	if(empty($list)) return TRUE;
	$ret=true;
	foreach($list as $el) {
		if(is_dir($local."/".$el)) $t=$this->mput($local."/".$el, $remote."/".$el);
		else $t=$this->put($local."/".$el, $remote."/".$el);
		if(!$t) {
			$ret=FALSE;
			if(!$continious) break;
		}
	}
	return $ret;

}