ftp_base::mdelpublicWP 1.0

Method of the class: ftp_base{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ftp_base = new ftp_base();
$ftp_base->mdel( $remote, $continious );
$remote(required)
.
$continious
.
Default: false

ftp_base::mdel() code WP 6.8.1

function mdel($remote, $continious=false) {
	$list=$this->rawlist($remote, "-la");
	if($list===false) {
		$this->PushError("mdel","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents");
		return false;
	}

	foreach($list as $k=>$v) {
		$list[$k]=$this->parselisting($v);
		if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]);
	}
	$ret=true;

	foreach($list as $el) {
		if ( empty($el) )
			continue;

		if($el["type"]=="d") {
			if(!$this->mdel($remote."/".$el["name"], $continious)) {
				$ret=false;
				if(!$continious) break;
			}
		} else {
			if (!$this->delete($remote."/".$el["name"])) {
				$this->PushError("mdel", "cannot delete file", "Cannot delete remote file \"".$remote."/".$el["name"]."\"");
				$ret=false;
				if(!$continious) break;
			}
		}
	}

	if(!$this->rmdir($remote)) {
		$this->PushError("mdel", "cannot delete folder", "Cannot delete remote folder \"".$remote."/".$el["name"]."\"");
		$ret=false;
	}
	return $ret;
}