WP_Filesystem_SSH2::delete( string $file, bool $recursive = false, string|bool $type = false )
Parameters
- $file
-
(Required)
- $recursive
-
(Optional)
Default value: false
- $type
-
(Optional)
Default value: false
Return
(bool)
Source
File: wp-admin/includes/class-wp-filesystem-ssh2.php
public function delete($file, $recursive = false, $type = false) {
if ( 'f' == $type || $this->is_file($file) )
return ssh2_sftp_unlink($this->sftp_link, $file);
if ( ! $recursive )
return ssh2_sftp_rmdir($this->sftp_link, $file);
$filelist = $this->dirlist($file);
if ( is_array($filelist) ) {
foreach ( $filelist as $filename => $fileinfo) {
$this->delete($file . '/' . $filename, $recursive, $fileinfo['type']);
}
}
return ssh2_sftp_rmdir($this->sftp_link, $file);
}