本文整理汇总了PHP中Net_SFTP::size方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_SFTP::size方法的具体用法?PHP Net_SFTP::size怎么用?PHP Net_SFTP::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_SFTP
的用法示例。
在下文中一共展示了Net_SFTP::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dataPush
public function dataPush($date = '2014-12-14 00:00:00')
{
$res = array();
$dstFile = "iff_data_production/test_data.json";
$fileContents = "test content";
// set up basic connection
$domain = "sftp.tiger.jba-processing.com";
try {
$sftp = new Net_SFTP($domain);
if ($sftp->login('tiger_mccann', 'fsJcBsuepHMVrYrY')) {
$sftp->put($dstFile, $fileContents);
var_dump($sftp->size($dstFile));
var_dump($sftp->size('nonexistant.json'));
}
} catch (Exception $e) {
var_dump($e);
}
echo $sftp->getSFTPLog();
return;
}
示例2: stream_seek
/**
* This method is called in response to fseek()
*
* Seeks to specific location in a stream
*
* @param Integer $offset
* @param Integer $whence = SEEK_SET
* @return bool
* @access public
*/
public function stream_seek($offset, $whence)
{
$filesize = $this->sftp->size($this->path);
switch ($whence) {
case SEEK_SET:
if ($offset >= $filesize || $offset < 0) {
return FALSE;
}
break;
case SEEK_CUR:
$offset += $this->position;
break;
case SEEK_END:
$offset += $filesize;
break;
default:
return FALSE;
}
$this->position = $offset;
return TRUE;
}
示例3: size
public function size($file)
{
return $this->conn->size($file);
}
示例4: array
$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;
} else {
$log .= $ssh->exec(escapeshellcmd('vzdump --snapshot --compress --dumpdir /tmp/' . $dirname . ' ' . $container)) . PHP_EOL;
}
if (!$sftp->size('vzdump-' . $container . '.tgz')) {
$log .= 'vzdump-' . $container . '.tgz not found' . PHP_EOL;
} else {
$log .= 'CT backup completed, transferring CT ' . $container . PHP_EOL;
$sftpfiletransfer = $sftp->get('vzdump-' . $container . '.tgz', $dirname . '-vzdump-' . $container . '.tgz') . PHP_EOL;
if (!$sftpfiletransfer) {
$log .= 'CT transfer failed' . PHP_EOL;
} else {
$log .= $sftpfiletransfer;
$log .= $ssh->exec(escapeshellcmd('rm -f /tmp/' . $dirname . '/vzdump-' . $container . '.tgz')) . PHP_EOL;
$log .= rename($dirname . '-vzdump-' . $container . '.tgz', $config['path'] . '/files/' . $dirname . '-vzdump-' . $container . '.tgz') . PHP_EOL;
if (isset($backupjob['encryption']) && ($backupjob['encryption'] = 'AES-256')) {
$log .= 'Encrypting file with AES-256' . PHP_EOL;
$cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
$cipher->setKey($backupjob['encryptionkey']);
file_put_contents($config['path'] . '/files/' . $dirname . '-vzdump-' . $container . '.tgz', $cipher->encrypt(file_get_contents($config['path'] . '/files/' . $dirname . '-vzdump-' . $container . '.tgz')));
示例5: signup
public function signup($user, $member)
{
// Campaign Monitor
$cm_details = Config::get('services.campaignmonitor');
$campaignmonitor = new CS_REST_Subscribers($cm_details['list_id'], $cm_details['auth_details']);
$result = $campaignmonitor->add(array('EmailAddress' => $user->email, 'Name' => $member->firstname . ' ' . $member->lastname, 'CustomFields' => array(), 'Resubscribe' => false));
// Boxever
$keys = "?client_key=mz5gfrJyaUcG4Pc2uugPhupj3KRV5kMt&api_token=ADvnoiQ4HJsgzt5479ltfu77Z6pTCweO&";
$res = $this->curlGet('https://api.boxever.com/v1.2/customer/search.json' . $keys . "email=" . $user->email);
$dobISO = new DateTime($member->dob);
$nowISO = new DateTime();
$message = array('first_name' => $member->firstname, 'lastname' => $member->lastname, 'dob' => $dobISO->format(DateTime::ISO8601), 'email' => $user->email, 'phone' => $member->phone, 'address' => $member->address, 'postcode' => $member->postcode, 'state' => $member->state, 'tiff_has_flown' => $member->hasflown == 'y' ? true : false, 'tiff_flights_per_year' => $member->flightsperyear, 'tiff_member' => true, 'subscriptions' => array(array('name' => "infrequent_flyers", 'pos' => "default", 'medium' => "EMAIL", 'status' => "SUBSCRIBED", 'effectiveDate' => urlencode($nowISO->format(DateTime::ISO8601)))));
foreach ($message as $key => $val) {
if (gettype($val) === 'string') {
$message[$key] = urlencode($val);
}
}
// Upload to SFTP server
$dstFile = "iff_data_production/{$member->id}.json";
$fileContents = json_encode($message);
// set up basic connection
$domain = "sftp.tiger.jba-processing.com";
try {
$sftp = new Net_SFTP($domain);
// Turn on logging
define('NET_SFTP_LOGGING', NET_SFTP_LOG_COMPLEX);
// Attempt login
if ($sftp->login('tiger_mccann', 'fsJcBsuepHMVrYrY')) {
// Attempt upload
$i = 0;
do {
$sftp->put($dstFile, $fileContents);
} while ($sftp->size($dstFile) === false && ++$i < 5);
} else {
Log::error("SFTP Login failed");
}
} catch (Exception $e) {
Log::error($e);
}
Log::error($sftp->getSFTPLog());
// No longer sending to Boxever
/*
if ($res->status == 'OK' && !isset($res->customer_ref)) {
// Customer doesn't exist, create new customer
//
// Boxever doesn't seem to return a customer_ref even if the customer exists...
// So we'll attempt to add it, and if it fails, then the user already exists in our list.
$message['customer_id'] = urlencode($user->email);
$message = json_encode($message);
$res = $this->curlGet('https://api.boxever.com/v1.2/customer/create.json' . $keys . 'message=' . $message );
} else if (isset($res->customer_ref)) {
// Customer exists, update their data
$message = json_encode($message);
$res = $this->curlGet('https://api.boxever.com/v1.2/customer/'.$res->customer_ref[0].'/update.json' . $keys . 'message=' . $message);
} else {
// Initial resource request failed
$boxever = 'API Failed';
}
*/
return $res;
}