當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Net_SFTP::disconnect方法代碼示例

本文整理匯總了PHP中Net_SFTP::disconnect方法的典型用法代碼示例。如果您正苦於以下問題:PHP Net_SFTP::disconnect方法的具體用法?PHP Net_SFTP::disconnect怎麽用?PHP Net_SFTP::disconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Net_SFTP的用法示例。


在下文中一共展示了Net_SFTP::disconnect方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: notifyConfigChange

 /**
  * Notify about config changes.
  */
 public function notifyConfigChange()
 {
     $host = $this->config->get(FilesystemConfig::HOST);
     $port = $this->config->get(FilesystemConfig::PORT);
     $username = $this->config->get(FilesystemConfig::USERNAME);
     $password = $this->config->get(FilesystemConfig::PASSWORD);
     $key = $this->config->get(self::CONFIG_KEY);
     $keyFile = $this->config->get(self::CONFIG_KEY_FILE);
     $basepath = $this->config->get('/' . FilesystemConfig::BASEPATH);
     if ($basepath) {
         $basepath = Util::normalizePath($basepath);
     }
     $connectUrl = $username;
     if ($keyFile) {
         $connectUrl .= ':' . crypt($keyFile . $password);
     } else {
         if ($key) {
             $connectUrl .= ':' . crypt($key . $password);
         } else {
             if ($password) {
                 $connectUrl .= ':' . crypt($password);
             }
         }
     }
     $connectUrl .= '@' . $host;
     if ($port) {
         $connectUrl .= ':' . $port;
     }
     $connectUrl .= $basepath;
     if ($this->connectionURL != $connectUrl) {
         if ($this->connection) {
             $this->connection->disconnect();
             $this->connection = null;
         }
         $this->connectionURL = $connectUrl;
     }
 }
開發者ID:filicious,項目名稱:sftp,代碼行數:40,代碼來源:SFTPAdapter.php

示例2: close

 /**
  * Close a connection
  *
  */
 public function close()
 {
     return $this->_connection->disconnect();
 }
開發者ID:Airmal,項目名稱:Magento-Em,代碼行數:8,代碼來源:Sftp.php

示例3: header

     }
     ###
     $aes = new Crypt_AES();
     $aes->setKeyLength(256);
     $aes->setKey(CRYPT_KEY);
     // Get SFTP
     $sftp = new Net_SFTP($box['ip'], $box['sshport']);
     if (!$sftp->login($box['login'], $aes->decrypt($box['password']))) {
         $_SESSION['msg1'] = T_('Connection Error!');
         $_SESSION['msg2'] = '';
         $_SESSION['msg-type'] = 'error';
         header("Location: server.php?id=" . urlencode($serverid));
         die;
     }
     $log = $sftp->get(dirname($server['path']) . '/screenlog.0');
     $sftp->disconnect();
     //Adding event to the database
     $message = mysql_real_escape_string($server['name']) . ' : screenlog downloaded';
     query_basic("INSERT INTO `" . DBPREFIX . "log` SET `serverid` = '" . $serverid . "', `message` = '" . $message . "', `name` = '" . $_SESSION['clientfirstname'] . " " . $_SESSION['clientlastname'] . "', `ip` = '" . $_SERVER['REMOTE_ADDR'] . "'");
     ###
     header('Content-type: text/plain');
     header('Content-Disposition: attachment; filename="' . $server['screen'] . '_' . date('Y-m-d') . '.screenlog"');
     echo $log;
     ###
     die;
     break;
 case 'serverstart':
     require_once "./libs/gameinstaller/gameinstaller.php";
     ###
     $serverid = $_GET['serverid'];
     ###
開發者ID:Scarsz,項目名稱:bgpanel-dev,代碼行數:31,代碼來源:serverprocess.php

示例4: extract

 /**
  * Downloads backup file from server from remote ftp server to root folder on local server.
  *
  * @param 	array 	$args	arguments passed to the function
  * [ftp_username] -> ftp username on remote server
  * [ftp_password] -> ftp password on remote server
  * [ftp_hostname] -> ftp hostname of remote host
  * [ftp_remote_folder] -> folder on remote site which backup file should be downloaded from
  * [ftp_site_folder] -> subfolder with site name in ftp_remote_folder which backup file should be downloaded from
  * [backup_file] -> absolute path of backup file on local server
  * @return 	string|array	absolute path to downloaded file is successful, array with error message if not
  */
 function get_sftp_backup($args)
 {
     extract($args);
     file_put_contents("sftp_log.txt", "get_sftp_backup", FILE_APPEND);
     $port = $sftp_port ? $sftp_port : 22;
     //default port is 21        $sftp_hostname = $sftp_hostname?$sftp_hostname:"";
     file_put_contents("sftp_log.txt", "sftp port:" . $sftp_port, FILE_APPEND);
     $sftp_username = $sftp_username ? $sftp_username : "";
     $sftp_password = $sftp_password ? $sftp_password : "";
     file_put_contents("sftp_log.txt", "sftp host:" . $sftp_hostname . ";username:" . $sftp_username . ";password:" . $sftp_password, FILE_APPEND);
     $sftp = new Net_SFTP($sftp_hostname);
     if (!$sftp->login($sftp_username, $sftp_password)) {
         file_put_contents("sftp_log.txt", "sftp login failed in get_sftp_backup", FILE_APPEND);
         return false;
     }
     $remote = $sftp_remote_folder ? trim($sftp_remote_folder, "/") . "/" : '';
     if ($ftp_site_folder) {
         $remote .= '/' . $this->site_name;
     }
     $temp = ABSPATH . 'mwp_temp_backup.zip';
     $get = $sftp->get($remote . '/' . $backup_file, $temp);
     $sftp->disconnect();
     if ($get === false) {
         file_put_contents("sftp_log.txt", "sftp get failed in get_sftp_backup", FILE_APPEND);
         return false;
     }
     return $temp;
 }
開發者ID:jeanpage,項目名稱:ca_learn,代碼行數:40,代碼來源:backup.class.php


注:本文中的Net_SFTP::disconnect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。