当前位置: 首页>>代码示例>>PHP>>正文


PHP Net_SFTP::chdir方法代码示例

本文整理汇总了PHP中Net_SFTP::chdir方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_SFTP::chdir方法的具体用法?PHP Net_SFTP::chdir怎么用?PHP Net_SFTP::chdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Net_SFTP的用法示例。


在下文中一共展示了Net_SFTP::chdir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: escribe_archivo_via_sftp

function escribe_archivo_via_sftp($cadena, $nombre_archivo_remoto = "", $factura_id, $fe_folio)
{
    $sql_update = "update vta_p_facturas set \n\tFE_SERIE='A', FE_FOLIO={$fe_folio}\n\twhere (FE_SERIE = '' OR FE_SERIE IS NULL or FE_SERIE=0) AND (FE_FOLIO = '' OR FE_FOLIO IS NULL or FE_FOLIO =0) \n\tAND FACTURA_ID=" . $factura_id;
    $result_update = mysql_db_query(DB_NAME, $sql_update);
    // echo $sql_update;
    define("TEPath", "../TableEditor/");
    include '../TableEditor/Net/SFTP.php';
    //  $ftp_sitio="demo-partners.xsa.com.mx";
    //  $ftp_usuario="testftpfacciisa";
    //  $ftp_pass="testftpfacciisa";
    $ftp_sitio = "173.205.255.84";
    $ftp_usuario = "ftpciisa";
    $ftp_pass = "ciisa201104";
    $sftp = new Net_SFTP($ftp_sitio);
    if (!$sftp->login($ftp_usuario, $ftp_pass)) {
        exit('Acceso incorrecto..');
    }
    $sftp->put($nombre_archivo_remoto, utf8_encode($cadena));
    $sftp->chdir("1");
    $sftp->put($nombre_archivo_remoto, utf8_encode($cadena));
    $folio_fiscal = consulta("select FOLIO_FISCAL from vta_p_facturas WHERE FACTURA_ID=" . $factura_id);
    $folio_fiscal = $folio_fiscal["FOLIO_FISCAL"];
    //echo $fe_serie["FE_FOLIO"]."+";
    echo "Envio exitoso... Factura " . $folio_fiscal;
}
开发者ID:alexlqi,项目名称:adminte_git,代码行数:25,代码来源:funciones_generales.php

示例2: _changeDirectory

 /**
  * Change the directory to the target directory
  *
  * @param String $directory directory path
  *
  * @return bool
  * @throws CMbException
  */
 private function _changeDirectory($directory)
 {
     if (!$this->connexion) {
         throw new CMbException("CSourceSFTP-connexion-failed", $this->hostname);
     }
     if (!($chdir = $this->connexion->chdir($directory))) {
         throw new CMbException("CSourceSFTP-change-directory-failed", $directory);
     }
     return true;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:18,代码来源:CSFTP.class.php

示例3: getSftp

 /**
  * @param array $config
  *
  * @throws Mageplace_Backup_Exception|Mage_Core_Exception
  * @return Net_SFTP
  */
 public function getSftp(array $config = array())
 {
     if ($this->_getData('sftp') === null) {
         $host = $this->getConfigValue(self::HOST);
         $port = (int) $this->getConfigValue(self::PORT);
         if ($port <= 0) {
             $port = self::DEFAULT_PORT;
         }
         $sftp = new Net_SFTP($host, $port, $this->getTimeOut());
         if (!$sftp->login($this->getConfigValue(self::USERNAME), $this->getConfigValue(self::PASSWORD))) {
             $this->_throwExeption($this->_helper->__("SFTP connection error: unable to open connection as %s@%s:%d", $this->getConfigValue(self::USERNAME), $host, $port));
         }
         if ($path = rtrim($this->getConfigValue(self::PATH), '/')) {
             if (!$sftp->chdir($path)) {
                 $this->_throwExeption($this->_helper->__('SFTP connection error: invalid path'));
             }
         }
         $this->setData('sftp', $sftp);
     }
     return $this->_getData('sftp');
 }
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:27,代码来源:Sftp.php

示例4: extract

 function get_ftp_backup($args, $current_file_num = 0)
 {
     extract($args);
     if (isset($use_sftp) && $use_sftp == 1) {
         $port = $ftp_port ? $ftp_port : 22;
         //default port is 22
         /*
          * SFTP section start here phpseclib library is used for this functionality
          */
         $iwp_mmb_plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
         $path = $iwp_mmb_plugin_dir . '/lib/phpseclib';
         set_include_path(get_include_path() . PATH_SEPARATOR . $path);
         include_once 'Net/SFTP.php';
         $sftp = new Net_SFTP($ftp_hostname, $port);
         if (!$sftp) {
             return array('error' => 'Failed to connect to ' . $ftp_hostname, 'partial' => 1);
         }
         if (!$sftp->login($ftp_username, $ftp_password)) {
             return array('error' => 'FTP login failed for ' . $ftp_username . ', ' . $ftp_password, 'partial' => 1);
         } else {
             if ($ftp_site_folder) {
                 $ftp_remote_folder .= '/' . $this->site_name;
             }
             $remote_loation = basename($backup_file);
             $local_location = $backup_file;
             $sftp->chdir($ftp_remote_folder);
             //$sftp->delete(basename($backup_file));
             $temp = wp_tempnam('iwp_temp_backup.zip');
             $get = $sftp->get(basename($backup_file), $temp);
             if ($get === false) {
                 return false;
             } else {
                 return $temp;
             }
             //SFTP library has automatic connection closed. So no need to call seperate connection close function
         }
     } else {
         //Args: $ftp_username, $ftp_password, $ftp_hostname, $backup_file, $ftp_remote_folder
         $port = $ftp_port ? $ftp_port : 21;
         //default port is 21
         if ($ftp_ssl && function_exists('ftp_ssl_connect')) {
             $conn_id = ftp_ssl_connect($ftp_hostname, $port);
         } else {
             if (function_exists('ftp_connect')) {
                 $conn_id = ftp_connect($ftp_hostname, $port);
                 if ($conn_id === false) {
                     return false;
                 }
             }
         }
         $login = @ftp_login($conn_id, $ftp_username, $ftp_password);
         if ($login === false) {
             return false;
         }
         if ($ftp_site_folder) {
             $ftp_remote_folder .= '/' . $this->site_name;
         }
         if ($ftp_passive) {
             @ftp_pasv($conn_id, true);
         }
         //$temp = ABSPATH . 'iwp_temp_backup.zip';
         $temp = wp_tempnam('iwp_temp_backup.zip');
         $get = ftp_get($conn_id, $temp, $ftp_remote_folder . '/' . $backup_file, FTP_BINARY);
         if ($get === false) {
             return false;
         } else {
         }
         ftp_close($conn_id);
         return $temp;
     }
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:71,代码来源:backup.class.multicall.php

示例5: cd

 /**
  * Change current working directory
  *
  */
 public function cd($dir)
 {
     return $this->_connection->chdir($dir);
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:8,代码来源:Sftp.php

示例6: explode

     // Handle custom sFTP port.
     $server_params = explode(':', $server);
     $server = $server_params[0];
     $port = $server_params[1];
 }
 pb_backupbuddy::status('details', 'Connecting to sFTP server...');
 $sftp = new Net_SFTP($server, $port);
 if (!$sftp->login($destination['username'], $destination['password'])) {
     pb_backupbuddy::status('error', 'Connection to sFTP server FAILED.');
     return false;
 } else {
     pb_backupbuddy::status('details', 'Success connecting to sFTP server.');
 }
 // Change to directory.
 pb_backupbuddy::status('details', 'Attempting to change into directory...');
 if (true === $sftp->chdir($destination['path'])) {
     pb_backupbuddy::status('details', 'Changed into directory.');
 } else {
     pb_backupbuddy::status('error', 'Unable to change into specified path. Verify the path is correct with valid permissions.');
     return false;
 }
 // loop through and delete ftp backup files
 foreach ((array) pb_backupbuddy::_POST('items') as $backup) {
     // try to delete backup
     if (true === $sftp->delete($backup)) {
         $delete_count++;
     } else {
         pb_backupbuddy::alert('Unable to delete file `' . $destination['path'] . '/' . $backup . '`.');
     }
 }
 if ($delete_count > 0) {
开发者ID:elephantcode,项目名称:elephantcode,代码行数:31,代码来源:_manage.php

示例7: unlink

	exit(0);
}*/
//if(file_exists($encryptedFileName))
if (file_exists($localfilename)) {
    include "Net/SFTP.php";
    $ftp_server = 'PDCFTP.cvty.com';
    $ftp_user = 'USImaging';
    $ftp_password = '0651Srqk0688Osuc';
    $ftp_port = '21000';
    $ftp_directory = '/Incoming/';
    //'/Test/Incoming/'
    $sftp = new Net_SFTP($ftp_server, $ftp_port);
    // FTP Login
    if ($sftp->login($ftp_user, $ftp_password)) {
        // Change directory
        if ($sftp->chdir($ftp_directory)) {
            if ($sftp->put($remoteFileName, $localfilename, NET_SFTP_LOCAL_FILE)) {
                $destFileName = str_replace('C:\\Inetpub\\wwwroot\\plexis\\php\\', 'D:\\Documents\\Misc\\' . $clientName . "_", $savePathAndFileName);
                //echo "destFileName:  ".$destFileName."\n";
                //echo "localfilename:  ".$localfilename."\n";
                //echo "remoteFileName:  ".$remoteFileName."\n";
                if (file_exists($destFileName)) {
                    unlink($destFileName);
                }
                rename($localfilename, $destFileName);
            } else {
                $msg = "Unable to put " . $localfilename . " file to [" . $ftp_server . "] /" . $ftp_directory . "/" . $remoteFileName . "<br/>";
            }
        } else {
            $msg = "chdir failed to [" . $ftp_server . "] " . $ftp_directory;
        }
开发者ID:jasmith152,项目名称:plexis,代码行数:31,代码来源:Weekly_Appointment_Summary.php

示例8: exitcron

 if (strpos($verifyvzdump, 'command not found') !== false) {
     $log .= 'vzdump command not found' . PHP_EOL;
     exitcron();
 } else {
     $log .= 'vzdump detected' . PHP_EOL;
 }
 $verifyproxmox = $ssh->exec(escapeshellcmd('pveversion -v'));
 if (strpos($verifyproxmox, 'pve-manager') !== false) {
     $log .= 'ProxMox detected' . PHP_EOL;
     $isproxmox = true;
 } else {
     $log .= 'Standard OpenVZ detected' . PHP_EOL;
     $isproxmox = false;
 }
 $log .= $ssh->exec(escapeshellcmd('mkdir /tmp/' . $dirname)) . PHP_EOL;
 $sftp->chdir('/tmp/' . $dirname);
 $containers = $ssh->exec(escapeshellcmd('vzlist -jao ctid'));
 $containers = json_decode($containers, true);
 $donotbackup = explode(' ', $backupjob['directory']);
 $containerstobackup = array();
 foreach ($containers as $container) {
     if (!in_array($container['ctid'], $donotbackup)) {
         $containerstobackup[count($containerstobackup)] = $container['ctid'];
     }
 }
 foreach ($containerstobackup as $container) {
     $log .= 'Backing up CT ' . $container . PHP_EOL;
     $vzstarttime = time();
     if ($isproxmox) {
         $log .= $ssh->exec(escapeshellcmd('vzdump -mode snapshot -compress gzip -dumpdir /tmp/' . $dirname . ' ' . $container)) . PHP_EOL;
         $log .= $ssh->exec(escapeshellcmd('mv vzdump-openvz-*.tgz vzdump-' . $container . '.tgz')) . PHP_EOL;
开发者ID:xiaokangrj,项目名称:cdp,代码行数:31,代码来源:cron.php

示例9: die

         die('SSH key login failed');
     }
     if (!$sftp->login($backupserver['username'], $key)) {
         die('SFTP key login failed');
     }
 } else {
     die('SSH login failed');
 }
 $verifyvzdump = $ssh->exec(escapeshellcmd('vzdump'));
 if (strpos($verifyvzdump, 'command not found') !== false) {
     echo 'vzdump command not found' . PHP_EOL;
     die;
 } else {
     echo 'vzdump detected' . PHP_EOL;
 }
 echo $sftp->chdir('/');
 if (isset($backupjob['encryption']) && $backupjob['encryption'] == 'AES-256') {
     echo 'Decrypting file with AES-256' . PHP_EOL;
     $cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
     $cipher->setKey($backupjob['encryptionkey']);
     file_put_contents($config['path'] . '/files/' . $argv[1] . '.decrypted', $cipher->decrypt(file_get_contents($config['path'] . '/files/' . $argv[1])));
     echo 'Transferring the file' . PHP_EOL;
     echo $sftp->put($argv[1], $config['path'] . '/files/' . $argv[1] . '.decrypted', NET_SFTP_LOCAL_FILE);
     unlink($config['path'] . '/files/' . $argv[1] . '.decrypted');
 } else {
     echo 'Transferring the file' . PHP_EOL;
     echo $sftp->put($argv[1], $config['path'] . '/files/' . $argv[1], NET_SFTP_LOCAL_FILE);
 }
 $ctid = explode('vzdump-', trim($argv[1]));
 $ctid = explode('.tgz', $ctid[1]);
 echo $ssh->exec(escapeshellcmd('vzctl stop ' . $ctid[0]));
开发者ID:xiaokangrj,项目名称:cdp,代码行数:31,代码来源:restore.php

示例10: exit

<?php

include_once '../settings/autoload.php';
$msql = SafeMySQL::getInstance();
$sftp = new Net_SFTP(PSGlobalCollect::FTP_URL);
if (!$sftp->login(PSGlobalCollect::FTP_LOGIN, PSGlobalCollect::FTP_PASSWORD)) {
    exit('Login Failed');
}
$sftp->chdir('out');
$files = $sftp->nlist();
$wr1 = array();
foreach ($files as $filename) {
    if (substr($filename, 0, 4) == '7760' && substr($filename, -4) == '.wr1') {
        $wr1[] = $filename;
    }
}
sort($wr1);
foreach ($wr1 as $filename) {
    echo $filename . '<br />';
    $sql = "SELECT * FROM `wr1` WHERE `filename` = ?s";
    $result = $msql->query($sql, substr($filename, 0, 8));
    if (!$result->num_rows) {
        $wr1File = $sftp->get($filename);
        if (strlen($wr1File) != 802) {
            preg_match_all('/^.{3}7760.{43}LJ(\\d+).*$/m', $wr1File, $matches);
            $orderIDs = array_unique($matches[1]);
            sort($orderIDs);
            $ordersArr = array();
            foreach ($orderIDs as $order) {
                $ordersArr[] = '(' . (int) $order . ')';
            }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例11: extract

 function remove_ftp_backup($args)
 {
     extract($args);
     //Args: $ftp_username, $ftp_password, $ftp_hostname, $backup_file, $ftp_remote_folder
     if (isset($use_sftp) && $use_sftp == 1) {
         $port = $ftp_port ? $ftp_port : 22;
         //default port is 22
         /*
          * SFTP section start here phpseclib library is used for this functionality
          */
         $iwp_mmb_plugin_dir = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
         $path = $iwp_mmb_plugin_dir . '/lib/phpseclib';
         set_include_path(get_include_path() . PATH_SEPARATOR . $path);
         include_once 'Net/SFTP.php';
         $sftp = new Net_SFTP($ftp_hostname, $port);
         if (!$sftp) {
             return array('error' => 'Failed to connect to ' . $ftp_hostname, 'partial' => 1);
         }
         if (!$sftp->login($ftp_username, $ftp_password)) {
             return array('error' => 'FTP login failed for ' . $ftp_username . ', ' . $ftp_password, 'partial' => 1);
         } else {
             if ($ftp_site_folder) {
                 $ftp_remote_folder .= '/' . $this->site_name;
             }
             $remote_loation = basename($backup_file);
             $local_location = $backup_file;
             $sftp->chdir($ftp_remote_folder);
             $sftp->delete(basename($backup_file));
         }
         //SFTP library has automatic connection closed. So no need to call seperate connection close function
     } else {
         $port = $ftp_port ? $ftp_port : 21;
         //default port is 21
         if ($ftp_ssl && function_exists('ftp_ssl_connect')) {
             $conn_id = ftp_ssl_connect($ftp_hostname, $port);
         } else {
             if (function_exists('ftp_connect')) {
                 $conn_id = ftp_connect($ftp_hostname, $port);
             }
         }
         if ($conn_id) {
             $login = @ftp_login($conn_id, $ftp_username, $ftp_password);
             if ($ftp_site_folder) {
                 $ftp_remote_folder .= '/' . $this->site_name;
             }
             if ($ftp_passive) {
                 @ftp_pasv($conn_id, true);
             }
             if (!is_array($backup_file)) {
                 $temp_backup_file = $backup_file;
                 $backup_file = array();
                 $backup_file[] = $temp_backup_file;
             }
             foreach ($backup_file as $key => $value) {
                 $delete = ftp_delete($conn_id, $ftp_remote_folder . '/' . $value);
             }
             ftp_close($conn_id);
         }
     }
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:60,代码来源:backup.class.singlecall.php

示例12: connect

 public function connect()
 {
     // we have to mangle the include path a little to find our plugins
     $oldIncludePath = get_include_path();
     set_include_path($oldIncludePath . ':' . TL_ROOT . '/plugins/phpseclib/:' . TL_ROOT . '/plugins/phpseclib/Net:' . TL_ROOT . '/plugins/phpseclib/Crypt');
     include 'SFTP.php';
     if ($GLOBALS['TL_CONFIG']['sftpKeyFile']) {
         include 'RSA.php';
     }
     set_include_path($oldIncludePath);
     $this->ftpHost = $GLOBALS['TL_CONFIG']['ftpHost'];
     $this->ftpPort = $GLOBALS['TL_CONFIG']['ftpPort'];
     $this->ftpUser = $GLOBALS['TL_CONFIG']['ftpUser'];
     if ($GLOBALS['TL_CONFIG']['sftpKeyFile']) {
         $key = new Crypt_RSA();
         if ($GLOBALS['TL_CONFIG']['sftpKeyPass']) {
             $key->setPassword($GLOBALS['TL_CONFIG']['sftpKeyPass']);
         }
         $key->loadKey(file_get_contents($GLOBALS['TL_CONFIG']['sftpKeyFile']));
         $this->ftpPass = $key;
     } else {
         $this->ftpPass = $GLOBALS['TL_CONFIG']['ftpPass'];
     }
     $this->ftpPath = $GLOBALS['TL_CONFIG']['ftpPath'];
     // Connect to FTP server
     if (!is_numeric($this->ftpPort) || $this->ftpPort == 0) {
         $this->ftpPort = 22;
     }
     if ($GLOBALS['TL_CONFIG']['debugSmhExtended']) {
         define('NET_SSH2_LOGGING', true);
         define('NET_SFTP_LOGGING', true);
     }
     if (($resConnection = new Net_SFTP($this->ftpHost, $this->ftpPort, 5)) != false) {
         // Login
         if (!$resConnection->login($this->ftpUser, $this->ftpPass)) {
             throw new Exception('Could not login to sftp: ' . $resConnection->getLastError() . (defined('NET_SSH2_LOGGING') ? implode("\n", $resConnection->message_number_log) : ''));
         }
         // security, clean user id and password as we won't need them anymore.
         $this->ftpUser = NULL;
         $this->ftpPass = NULL;
         // change to root directory to ensure we can really work.
         $resConnection->chdir($this->ftpPath);
         $this->resConnection = $resConnection;
         return $resConnection;
     } else {
         throw new Exception('Could not connect to sftp: ' . $resConnection->getLastError());
     }
 }
开发者ID:unmaintained-stuff,项目名称:tl_smhextended,代码行数:48,代码来源:SMHSFTP.php

示例13: getConnection

 /**
  * @return \Net_SFTP
  * @throws \Exception
  */
 protected function getConnection()
 {
     if (!$this->connection) {
         $host = $this->config->get(FilesystemConfig::HOST);
         $port = $this->config->get(FilesystemConfig::PORT, 22);
         $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 = Util::normalizePath('/' . $this->config->get(FilesystemConfig::BASEPATH, ''));
         if ($keyFile) {
             $key = file_get_contents($keyFile);
         }
         if ($key) {
             $key = new \Crypt_RSA();
             if ($password) {
                 $key->setPassword($password);
             }
             $key->loadKey($key);
             $password = $key;
         }
         $connection = new \Net_SFTP($host, $port);
         if (!$connection->login($username, $password)) {
             throw new \Exception(sprintf('Could not login to %s', $host));
         }
         if ($basepath != '/') {
             $connection->chdir($basepath);
         }
         $this->connection = $connection;
         $this->basepath = $connection->pwd() . '/';
     }
     return $this->connection;
 }
开发者ID:filicious,项目名称:sftp,代码行数:37,代码来源:SFTPAdapter.php

示例14: send

 public static function send($settings = array(), $files = array(), $send_id = '')
 {
     global $pb_backupbuddy_destination_errors;
     if ('1' == $settings['disabled']) {
         $pb_backupbuddy_destination_errors[] = __('Error #48933: This destination is currently disabled. Enable it under this destination\'s Advanced Settings.', 'it-l10n-backupbuddy');
         return false;
     }
     if (!is_array($files)) {
         $files = array($files);
     }
     pb_backupbuddy::status('details', 'FTP class send() function started.');
     self::_init();
     // Connect to server.
     $server = $settings['address'];
     $port = '22';
     // Default sFTP port.
     if (strstr($server, ':')) {
         // Handle custom sFTP port.
         $server_params = explode(':', $server);
         $server = $server_params[0];
         $port = $server_params[1];
     }
     pb_backupbuddy::status('details', 'Connecting to sFTP server...');
     $sftp = new Net_SFTP($server, $port);
     if (!$sftp->login($settings['username'], $settings['password'])) {
         pb_backupbuddy::status('error', 'Connection to sFTP server FAILED.');
         pb_backupbuddy::status('details', 'sFTP log (if available & enabled via full logging mode): `' . $sftp->getSFTPLog() . '`.');
         return false;
     } else {
         pb_backupbuddy::status('details', 'Success connecting to sFTP server.');
     }
     pb_backupbuddy::status('details', 'Attempting to create path (if it does not exist)...');
     if (true === $sftp->mkdir($settings['path'])) {
         // Try to make directory.
         pb_backupbuddy::status('details', 'Directory created.');
     } else {
         pb_backupbuddy::status('details', 'Directory not created.');
     }
     // Change to directory.
     pb_backupbuddy::status('details', 'Attempting to change into directory...');
     if (true === $sftp->chdir($settings['path'])) {
         pb_backupbuddy::status('details', 'Changed into directory `' . $settings['path'] . '`. All uploads will be relative to this.');
     } else {
         pb_backupbuddy::status('error', 'Unable to change into specified path. Verify the path is correct with valid permissions.');
         pb_backupbuddy::status('details', 'sFTP log (if available & enabled via full logging mode): `' . $sftp->getSFTPLog() . '`.');
         return false;
     }
     // Upload files.
     $total_transfer_size = 0;
     $total_transfer_time = 0;
     foreach ($files as $file) {
         if (!file_exists($file)) {
             pb_backupbuddy::status('error', 'Error #859485495. Could not upload local file `' . $file . '` to send to sFTP as it does not exist. Verify the file exists, permissions of file, parent directory, and that ownership is correct. You may need suphp installed on the server.');
         }
         if (!is_readable($file)) {
             pb_backupbuddy::status('error', 'Error #8594846548. Could not read local file `' . $file . '` to send to sFTP as it is not readable. Verify permissions of file, parent directory, and that ownership is correct. You may need suphp installed on the server.');
         }
         $filesize = filesize($file);
         $total_transfer_size += $filesize;
         $destination_file = basename($file);
         pb_backupbuddy::status('details', 'About to put to sFTP local file `' . $file . '` of size `' . pb_backupbuddy::$format->file_size($filesize) . '` to remote file `' . $destination_file . '`.');
         $send_time = -microtime(true);
         $upload = $sftp->put($destination_file, $file, NET_SFTP_LOCAL_FILE);
         $send_time += microtime(true);
         $total_transfer_time += $send_time;
         if ($upload === false) {
             // Failed sending.
             $error_message = 'ERROR #9012b ( http://ithemes.com/codex/page/BackupBuddy:_Error_Codes#9012 ).  sFTP file upload failed. Check file permissions & disk quota.';
             pb_backupbuddy::status('error', $error_message);
             backupbuddy_core::mail_error($error_message);
             pb_backupbuddy::status('details', 'sFTP log (if available & enabled via full logging mode): `' . $sftp->getSFTPLog() . '`.');
             return false;
         } else {
             // Success sending.
             pb_backupbuddy::status('details', 'Success completely sending `' . basename($file) . '` to destination.');
             // Start remote backup limit
             if ($settings['archive_limit'] > 0) {
                 pb_backupbuddy::status('details', 'Archive limit enabled. Getting contents of backup directory.');
                 $contents = $sftp->rawlist($settings['path']);
                 // already in destination directory/path.
                 // Create array of backups
                 $bkupprefix = backupbuddy_core::backup_prefix();
                 $backups = array();
                 foreach ($contents as $filename => $backup) {
                     // check if file is backup
                     $pos = strpos($filename, 'backup-' . $bkupprefix . '-');
                     if ($pos !== FALSE) {
                         $backups[] = array('file' => $filename, 'modified' => $backup['mtime']);
                     }
                 }
                 function backupbuddy_number_sort($a, $b)
                 {
                     return $a['modified'] < $b['modified'];
                 }
                 // Sort by modified using custom sort function above.
                 usort($backups, 'backupbuddy_number_sort');
                 if (count($backups) > $settings['archive_limit']) {
                     pb_backupbuddy::status('details', 'More backups found (' . count($backups) . ') than limit permits (' . $settings['archive_limit'] . ').' . print_r($backups, true));
                     $delete_fail_count = 0;
                     $i = 0;
//.........这里部分代码省略.........
开发者ID:elephantcode,项目名称:elephantcode,代码行数:101,代码来源:init.php

示例15: changeDir

 public function changeDir($dir)
 {
     return $this->conn->chdir($dir);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:4,代码来源:PwSftpSave.php


注:本文中的Net_SFTP::chdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。