本文整理汇总了PHP中ssh2_sftp_rmdir函数的典型用法代码示例。如果您正苦于以下问题:PHP ssh2_sftp_rmdir函数的具体用法?PHP ssh2_sftp_rmdir怎么用?PHP ssh2_sftp_rmdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ssh2_sftp_rmdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* @param $filename
*/
public function delete($filename)
{
if ($this->isDir($filename)) {
ssh2_sftp_rmdir($this->getSftpResource(), $filename);
} else {
ssh2_sftp_unlink($this->getSftpResource(), $filename);
}
}
示例2: remove
public function remove($remote)
{
$sftp = ssh2_sftp($this->conn_);
$rc = false;
if (is_dir("ssh2.sftp://{$sftp}/{$remote}")) {
$rc = ssh2_sftp_rmdir($sftp, $remote);
} else {
$rc = ssh2_sftp_unlink($sftp, $remote);
}
return $rc;
}
示例3: delete
public function delete($file, $recursive = false)
{
if ($this->is_file($file)) {
return ssh2_sftp_unlink($this->sftp, $file);
}
if (!$recursive) {
return ssh2_sftp_rmdir($this->sftp, $file);
}
$filelist = $this->getdir($file);
if (is_array($filelist)) {
foreach ($filelist as $filename => $fileinfo) {
$this->delete($file . '/' . $filename, $recursive);
}
}
return ssh2_sftp_rmdir($this->sftp, $file);
}
示例4: _removeDir_real
/**
* Remove Directory
*
* @param string $path Path to remove
* @return Object
*/
function _removeDir_real($path)
{
if (substr($path, 0, 2) == "./") {
$path = substr($path, 2);
}
$target_path = $this->ftp_info->ftp_root_path . $path;
if (!@ssh2_sftp_rmdir($this->sftp, $target_path)) {
return new Object(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
}
return new Object();
}
示例5: rmdir
/**
* @{inheritDoc}
*/
public function rmdir($dirname = '')
{
return $this->doRun(__METHOD__, func_get_args(), ssh2_sftp_rmdir($this->sftp, $dirname));
}
示例6: rmdir
public function rmdir($directory)
{
$check = '/' . trim($this->dir, '/') . '/' . trim($directory, '/');
return @ssh2_sftp_rmdir($this->handle, $check);
}
示例7: delete
/**
* Deletes a remote file.
*
* @param string $remote_path
* @param boolean $recursive
*
* @return boolean Returns TRUE on success or FALSE on error
*
* @throws \BackBee\Util\Transport\Exception\TransportException Occures if SSH connection is invalid
*/
public function delete($remote_path, $recursive = false)
{
if (null === $this->_sftp_resource) {
throw new TransportException(sprintf('None SSH connection available.'));
}
if (true === $recursive) {
// @todo
throw new TransportException(sprintf('REcursive option not implemented yet.'));
}
$remote_path = $this->_getAbsoluteRemotePath($remote_path);
if (false === @ssh2_sftp_stat($this->_sftp_resource, $remote_path)) {
return $this->_trigger_error(sprintf('Remote file to delete does not exist: %s.', $remote_path));
}
if (false === ssh2_sftp_unlink($this->_sftp_resource, $remote_path)) {
return ssh2_sftp_rmdir($this->_sftp_resource, $remote_path);
}
return true;
}
示例8: delete
/**
* @param string $identifier
* @param bool $recursive
* @return bool
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function delete($identifier, $recursive)
{
if (is_dir($this->sftpWrapper . $identifier)) {
return ssh2_sftp_rmdir($this->sftp, $identifier);
} elseif (is_file($this->sftpWrapper . $identifier)) {
return ssh2_sftp_unlink($this->sftp, $identifier);
} else {
return false;
}
}
示例9: delete_dir
/**
* Delete a folder and recursively delete everything (including sub-folders)
* containted within it.
*
* @access public
* @param string
* @return bool
*/
function delete_dir($filepath)
{
if (!$this->_is_conn()) {
return FALSE;
}
// Add a trailing slash to the file path if needed
$filepath = preg_replace("/(.+?)\\/*\$/", "\\1/", $filepath);
$result = @ssh2_sftp_rmdir($this->conn_id, $filepath);
if ($result === FALSE) {
$this->_error('sftp_unable_to_delete');
return FALSE;
}
return TRUE;
}
示例10: ssh2RemoveDirectory
function ssh2RemoveDirectory($directory)
{
$result = ssh2_sftp_rmdir($this->sftp, $directory);
return $result;
}
示例11: delete
/**
* Deletes an item on the SFTP server
*
* @author Art <a.molcanovas@gmail.com>
*
* @param string $item File or directory name
*
* @return boolean
*/
function delete($item)
{
$this->checkSubsystem();
$path = $this->resolvePath($item);
if (self::isFile($item)) {
$success = ssh2_sftp_unlink($this->sftp, $path);
} else {
$success = ssh2_sftp_rmdir($this->sftp, $path);
}
if ($success) {
\Log::debug('Deleted ' . $item);
return true;
} else {
\Log::error('Failed to delete ' . $item);
return false;
}
}
示例12: deleteDir
/**
* [deleteDir description]
* @param [type] $path [description]
* @return [type] [description]
*/
public function deleteDir($path)
{
if (false === $this->validConn()) {
throw new Exception('invalid connection');
}
if (!($this->sftp = @ssh2_sftp($this->conn))) {
throw new Exception("unable to establish sftp connection with {$host}");
}
return $this->sftp;
// Add a trailing slash to the file path if needed
$filepath = preg_replace("/(.+?)\\/*\$/", "\\1/", $path);
$list = $this->fileList($path);
if (count($list) > 0) {
foreach ($list as $item) {
if (!@ssh2_sftp_rmdir($this->sftp, $item)) {
$this->deleteDir($item);
}
}
}
return true;
}
示例13: doDelDir
/**
* Delete a directory and return true/false according to success.
* Wrapping ssh2_exec
*
* (non-PHPdoc)
* @see kFileTransferMgr::doDelDir()
*/
protected function doDelDir($remotePath)
{
return ssh2_sftp_rmdir($this->getSftpConnection(), $remotePath);
}
示例14: rmdir
public function rmdir($dirname)
{
return ssh2_sftp_rmdir($this->_sftp, $dirname);
}
示例15: rmdir
/**
* Removes a directory
*
* @param string $dirname The directory that is being removed
*
* @return Boolean TRUE on success, or FALSE on failure
*/
public function rmdir($dirname)
{
return ssh2_sftp_rmdir($this->getResource(), $dirname);
}