本文整理汇总了PHP中pb_backupbuddy_destinations::send方法的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy_destinations::send方法的具体用法?PHP pb_backupbuddy_destinations::send怎么用?PHP pb_backupbuddy_destinations::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_backupbuddy_destinations
的用法示例。
在下文中一共展示了pb_backupbuddy_destinations::send方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
public static function test($settings)
{
/*
if ( ( $settings['address'] == '' ) || ( $settings['username'] == '' ) || ( $settings['password'] == '' ) ) {
return __('Missing required input.', 'it-l10n-backupbuddy' );
}
*/
// Try sending a file.
return pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
// 3rd param true forces clearing of any current uploads.
}
示例2: test
public static function test($settings)
{
$remote_path = self::get_remote_path($settings['directory']);
// Has leading and trailng slashes.
$manage_data = pb_backupbuddy_destination_stash::get_manage_data($settings);
if (!is_array($manage_data['credentials'])) {
// Credentials were somehow faulty. User changed password after prior page? Unlikely but you never know...
$error_msg = 'Error #8484383c: Your authentication credentials for Stash failed. Verify your login and password to Stash. You may need to update the Stash destination settings. Perhaps you recently changed your password?';
pb_backupbuddy::status('error', $error_msg);
return $error_msg;
}
// Try sending a file.
$send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
// 3rd param true forces clearing of any current uploads.
if (false === $send_response) {
$send_response = 'Error sending test file to Stash.';
} else {
$send_response = 'Success.';
}
// S3 object for managing files.
$credentials = pb_backupbuddy_destination_stash::get_manage_data($settings);
$s3_manage = new AmazonS3($manage_data['credentials']);
if ($settings['ssl'] == 0) {
@$s3_manage->disable_ssl(true);
}
// Delete sent file.
$delete_response = 'Success.';
$delete_response = $s3_manage->delete_object($manage_data['bucket'], $manage_data['subkey'] . $remote_path . 'remote-send-test.php');
if (!$delete_response->isOK()) {
$delete_response = 'Unable to delete test Stash file `remote-send-test.php`. Details: `' . print_r($response, true) . '`.';
pb_backupbuddy::status('details', $delete_response);
} else {
$delete_response = 'Success.';
}
// Load destination fileoptions.
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
$fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
if (true !== ($result = $fileoptions_obj->is_ok())) {
pb_backupbuddy::status('error', __('Fatal Error #9034.84838. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
return false;
}
pb_backupbuddy::status('details', 'Fileoptions data loaded.');
$fileoptions =& $fileoptions_obj->options;
if ('Success.' != $send_response || 'Success.' != $delete_response) {
$fileoptions['status'] = 'failure';
$fileoptions_obj->save();
unset($fileoptions_obj);
return 'Send details: `' . $send_response . '`. Delete details: `' . $delete_response . '`.';
} else {
$fileoptions['status'] = 'success';
$fileoptions['finish_time'] = time();
}
$fileoptions_obj->save();
unset($fileoptions_obj);
return true;
}
示例3: destination_send
public static function destination_send($destination_settings, $files, $send_id = '', $delete_after = false, $isRetry = false)
{
// Pass off to destination handler.
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$send_result = pb_backupbuddy_destinations::send($destination_settings, $files, $send_id, $delete_after, $isRetry);
return $send_result;
}
示例4: destination_send
public function destination_send($destination_settings, $files)
{
// Pass off to destination handler.
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$send_result = pb_backupbuddy_destinations::send($destination_settings, $files);
return $send_result;
}
示例5: test
public static function test($settings)
{
$settings = self::_init($settings);
$sendOK = false;
$deleteOK = false;
$send_id = 'TEST-' . pb_backupbuddy::random_string(12);
// Try sending a file.
if ('1' == $settings['stash_mode']) {
// Stash mode.
$settings['type'] = 'stash2';
}
$send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id);
// 3rd param true forces clearing of any current uploads.
if (true === $send_response) {
$send_response = __('Success.', 'it-l10n-backupbuddy');
$sendOK = true;
} else {
global $pb_backupbuddy_destination_errors;
$send_response = 'Error sending test file to S3 (v2). Details: `' . implode(', ', $pb_backupbuddy_destination_errors) . '`.';
}
pb_backupbuddy::add_status_serial('remote_send-' . $send_id);
// Delete sent file if it was sent.
$delete_response = 'n/a';
if (true === $sendOK) {
pb_backupbuddy::status('details', 'Preparing to delete sent test file.');
if ('1' == $settings['stash_mode']) {
// Stash mode.
if (true === ($delete_response = pb_backupbuddy_destination_stash2::deleteFile($settings, 'remote-send-test.php'))) {
// success
$delete_response = __('Success.', 'it-l10n-backupbuddy');
$deleteOK = true;
} else {
// error
$error = 'Unable to delete Stash test file `remote-send-test.php`. Details: `' . $delete_response . '`.';
$delete_response = $error;
$deleteOK = false;
}
} else {
// S3 mode.
if (true === ($delete_response = self::deleteFile($settings, 'remote-send-test.php'))) {
$delete_response = __('Success.', 'it-l10n-backupbuddy');
$deleteOK = true;
} else {
$error = 'Unable to delete test file `remote-send-test.php`. Details: `' . $delete_response . '`.';
pb_backupbuddy::status('details', $error);
$delete_response = $error;
$deleteOK = false;
}
}
} else {
// end if $sendOK.
pb_backupbuddy::status('details', 'Skipping test delete due to failed send.');
}
// Load destination fileoptions.
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #7.');
$fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
if (true !== ($result = $fileoptions_obj->is_ok())) {
return self::_error(__('Fatal Error #9034.84838. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
}
pb_backupbuddy::status('details', 'Fileoptions data loaded.');
$fileoptions =& $fileoptions_obj->options;
if (true !== $sendOK || true !== $deleteOK) {
$fileoptions['status'] = 'failure';
$fileoptions_obj->save();
unset($fileoptions_obj);
return 'Send details: `' . $send_response . '`. Delete details: `' . $delete_response . '`.';
} else {
$fileoptions['status'] = 'success';
$fileoptions['finish_time'] = time();
}
$fileoptions_obj->save();
unset($fileoptions_obj);
pb_backupbuddy::status('details', 'Finished test function.');
return true;
}
示例6: test
public static function test($settings)
{
if (class_exists('CFRuntime')) {
die('CFRuntime already defined. Another plugin may be incorrectly loading its copy of S3 libraries on BackupBuddy pages.');
}
require_once dirname(dirname(__FILE__)) . '/_s3lib/aws-sdk/sdk.class.php';
$remote_path = self::get_remote_path($settings['directory']);
// Has leading and trailng slashes.
$settings['bucket'] = strtolower($settings['bucket']);
// Buckets must be lowercase.
/*
if ( FALSE !== strpos( $settings['bucket'], ' ' ) ) {
$message = 'Bucket names cannot have spaces in them.';
return $message;
}
*/
// Try sending a file.
$send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
// 3rd param true forces clearing of any current uploads.
if (false === $send_response) {
$send_response = 'Error sending test file to S3.';
} else {
$send_response = 'Success.';
}
// S3 object for managing files.
$credentials = pb_backupbuddy_destination_s3::get_credentials($settings);
$s3_manage = new AmazonS3($credentials);
if ($settings['ssl'] == 0) {
@$s3_manage->disable_ssl(true);
}
// Verify bucket exists; create if not. Also set region to the region bucket exists in.
if (false === self::_prepareBucketAndRegion($s3_manage, $settings)) {
return false;
}
// Delete sent file.
$delete_response = 'Success.';
$delete_response = $s3_manage->delete_object($credentials['bucket'], $remote_path . 'remote-send-test.php');
if (!$delete_response->isOK()) {
$delete_response = 'Unable to delete test S3 file `remote-send-test.php`.';
pb_backupbuddy::status('details', $delete_response . ' Details: `' . print_r($delete_response, true) . '`.');
} else {
$delete_response = 'Success.';
}
// Load destination fileoptions.
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #7.');
$fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
if (true !== ($result = $fileoptions_obj->is_ok())) {
pb_backupbuddy::status('error', __('Fatal Error #9034.84838. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
return false;
}
pb_backupbuddy::status('details', 'Fileoptions data loaded.');
$fileoptions =& $fileoptions_obj->options;
if ('Success.' != $send_response || 'Success.' != $delete_response) {
$fileoptions['status'] = 'failure';
$fileoptions_obj->save();
unset($fileoptions_obj);
return 'Send details: `' . $send_response . '`. Delete details: `' . $delete_response . '`.';
} else {
$fileoptions['status'] = 'success';
$fileoptions['finish_time'] = time();
}
$fileoptions_obj->save();
unset($fileoptions_obj);
return true;
}
示例7: test
public static function test($settings)
{
if ($settings['address'] == '' || $settings['username'] == '' || $settings['password'] == '') {
return __('Missing required input.', 'it-l10n-backupbuddy');
}
// Try sending a file.
$send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
// 3rd param true forces clearing of any current uploads.
if (false === $send_response) {
$send_response = 'Error sending test file to FTP.';
} else {
$send_response = 'Success.';
}
// Now we will need to go and cleanup this potentially uploaded file.
$delete_response = 'Error deleting test file from FTP.';
// Default.
// Settings.
$server = $settings['address'];
$username = $settings['username'];
$password = $settings['password'];
$path = $settings['path'];
$ftps = $settings['ftps'];
if ($settings['active_mode'] == '0') {
$active_mode = false;
} else {
$active_mode = true;
}
$url = $settings['url'];
// optional url for using with migration.
$port = '21';
if (strstr($server, ':')) {
$server_params = explode(':', $server);
$server = $server_params[0];
$port = $server_params[1];
}
// Connect.
if ($ftps == '0') {
$conn_id = @ftp_connect($server, $port, 10);
// timeout of 10 seconds.
if ($conn_id === false) {
$error = __('Unable to connect to FTP address `' . $server . '` on port `' . $port . '`.', 'it-l10n-backupbuddy');
$error .= "\n" . __('Verify the server address and port (default 21). Verify your host allows outgoing FTP connections.', 'it-l10n-backupbuddy');
return $send_response . ' ' . $error;
}
} else {
if (function_exists('ftp_ssl_connect')) {
$conn_id = @ftp_ssl_connect($server, $port);
if ($conn_id === false) {
return $send_response . ' ' . __('Destination server does not support FTPS?', 'it-l10n-backupbuddy');
}
} else {
return $send_response . ' ' . __('Your web server doesnt support FTPS.', 'it-l10n-backupbuddy');
}
}
$login_result = @ftp_login($conn_id, $username, $password);
if (!$conn_id || !$login_result) {
pb_backupbuddy::status('details', 'FTP test: Invalid user/pass.');
$response = __('Unable to login. Bad user/pass.', 'it-l10n-backupbuddy');
if ($ftps != '0') {
$response .= "\n\nNote: You have FTPs enabled. You may get this error if your host does not support encryption at this address/port.";
}
return $send_response . ' ' . $response;
}
pb_backupbuddy::status('details', 'FTP test: Success logging in.');
// Handle active/pasive mode.
if ($active_mode === true) {
// do nothing, active is default.
pb_backupbuddy::status('details', 'Active FTP mode based on settings.');
} elseif ($active_mode === false) {
// Turn passive mode on.
pb_backupbuddy::status('details', 'Passive FTP mode based on settings.');
ftp_pasv($conn_id, true);
} else {
pb_backupbuddy::status('error', 'Unknown FTP active/passive mode: `' . $active_mode . '`.');
}
// Delete test file.
pb_backupbuddy::status('details', 'FTP test: Deleting temp test file.');
if (true === ftp_delete($conn_id, $path . '/remote-send-test.php')) {
$delete_response = 'Success.';
}
// Close FTP connection.
pb_backupbuddy::status('details', 'FTP test: Closing FTP connection.');
@ftp_close($conn_id);
// Load destination fileoptions.
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #12.');
$fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
if (true !== ($result = $fileoptions_obj->is_ok())) {
pb_backupbuddy::status('error', __('Fatal Error #9034.72373. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
return false;
}
pb_backupbuddy::status('details', 'Fileoptions data loaded.');
$fileoptions =& $fileoptions_obj->options;
if ('Success.' != $send_response || 'Success.' != $delete_response) {
$fileoptions['status'] = 'failure';
$fileoptions_obj->save();
unset($fileoptions_obj);
return 'Send details: `' . $send_response . '`. Delete details: `' . $delete_response . '`.';
} else {
//.........这里部分代码省略.........
示例8: process_queue
public function process_queue()
{
// open queue file.
$max_session_size = '50';
// Size (MB) that is the max size sum of all files sent per instance. TODO: On timeout failure detect and scale back some to help with timeouts.
$max_session_time = '30';
// Currently only used to determine if we should auto-reduce the max session size if we are getting close to going over our time limit (help automatically avoid timeouts).
$send_now_files = array();
// Files that will be queued up to be sent this PHP instance.
$send_now_size = 0;
// Running sum of the size of all files queued up to be send this PHP instance.
$need_save = false;
// Whether or not we have updated something in the queue that needs saving.
$unsent_files = false;
foreach ($files as &$file) {
// Loop through files in queue that need sent to Live.
if ($send_now_size + $file['size'] <= $max_session_size) {
// There is room to add this file.
pb_backupbuddy::status('details', 'Added file `file.png` into queue.', 'live');
if ($file['attempts'] >= 3) {
// send error email notifying that its not going to make it. give suggestions. chunking?
pb_backupbuddy::status('error', 'Large 94 MB file `file.png` has timed out X times and has is on hold pending user intervention.', 'live');
} else {
$send_now_files .= $file;
$file['attempts']++;
$need_save = true;
}
} else {
// There is not room for this file.
if (count($send_now_files) == 0 && $file['size'] > $max_session_size) {
// If no files are queued in this send now list yet then we will try to send just this one big file on its own.
pb_backupbuddy::status('details', 'Large 94 MB file `file.png` exceeds max session size so it will be sent by itself to improve transfer success.', 'live');
$send_now_files .= $file;
$file['attempts']++;
$need_save = true;
$unsent_files = true;
break;
// We have maxed out the size with a single file so no need to keep going.
}
$unsent_files = true;
break;
// No more room for any other files if we made it here so stop looping.
}
}
// end foreach.
if ($need_save === true) {
pb_backupbuddy::status('details', 'Saving queue file.', 'live');
// Code to save the updated data structure to file.
// After saving add this file itself to the send queue so it (the queue file) gets backed up soon?
}
// Call Stash to send these files.
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$send_result = pb_backupbuddy_destinations::send($destination_settings, $send_now_files);
pb_backupbuddy::status('message', '4 MB file `file.png` Stashed in 12 seconds.', 'live');
pb_backupbuddy::status('message', '4 MB file `file.png` did not complete after 60 seconds. Stashing it will be re-attempted in 30 seconds.', 'live');
// remove all succesful transfers from the queue file and re-save it. be quick as we may be running out of time.
//
$this->kick_db();
// Kick the database to make sure it didn't go away, preventing options saving.
if ($unsent_files === true) {
// schedule next queue_process() call.
}
// make note in data structure the last time the queue was processed & status (sent X mb in Y seconds. all files succeeded[4/5 files succeded])
}
示例9: array
}
if ('enable' == pb_backupbuddy::_GET('deploy')) {
$identifier = pb_backupbuddy::random_string(12);
$deployFile = backupbuddy_core::getTempDirectory() . 'deploy-' . backupbuddy_core::backup_prefix() . '.dat';
// . '-' . $identifier .
$meta = array('siteurl' => site_url(), 'deployEnabled' => time());
$deployFileContents = json_encode($meta);
pb_backupbuddy::anti_directory_browsing(backupbuddy_core::getTempDirectory(), $die = false);
if (false === file_put_contents($deployFile, $deployFileContents)) {
pb_backupbuddy::alert('Error #848383: Unable to write temporary deployment file `' . $deployFile . '`. Verify permissions on the directory.');
} else {
$destinationSettings = pb_backupbuddy::$options['remote_destinations'][$stashDestination];
$destinationSettings['meta'] = $meta;
$destinationSettings['forceRootUpload'] = true;
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
$send_result = pb_backupbuddy_destinations::send($destinationSettings, array($deployFile), $identifier, $delete_after = true);
if (true === $send_result) {
pb_backupbuddy::$options['deployment_allowed'] = '1';
pb_backupbuddy::save();
pb_backupbuddy::alert(__('Deployments have been enabled for this site. Other sites sharing this Stash account may Push to or Pull from this site as long as your iThemes Member password is correctly provided.', 'it-l10n-backupbuddy'));
} else {
pb_backupbuddy::alert(__('Error #84838: Failure notifying Stash of new deployment site. See Remote Destinations page Recent Transfers listing for details.', 'it-l10n-backupbuddy'));
}
}
} elseif ('disable' == pb_backupbuddy::_GET('deploy')) {
pb_backupbuddy::$options['deployment_allowed'] = '0';
pb_backupbuddy::save();
pb_backupbuddy::alert(__('Deployments have been disabled for this site.', 'it-l10n-backupbuddy'));
}
}
if (false !== $stashDestination) {
示例10: test
public static function test($settings)
{
$settings = self::_init($settings);
// Try sending a file.
$send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
// 3rd param true forces clearing of any current uploads.
if (false === $send_response) {
$send_response = 'Error sending test file to S3.';
} else {
$send_response = 'Success.';
}
// Delete sent file.
$delete_response = 'Success.';
try {
$delete_response = self::$_client->delete_object(array('Bucket' => $settings['bucket'], 'Key' => $settings['directory'] . 'remote-send-test.php'));
$delete_response = 'Success.';
} catch (Exception $e) {
pb_backupbuddy::status('details', 'Unable to delete test S3 file `remote-send-test.php`. Details: `' . $e->getMessage() . '`.');
}
// Load destination fileoptions.
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #7.');
$fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
if (true !== ($result = $fileoptions_obj->is_ok())) {
return self::_error(__('Fatal Error #9034.84838. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
}
pb_backupbuddy::status('details', 'Fileoptions data loaded.');
$fileoptions =& $fileoptions_obj->options;
if ('Success.' != $send_response || 'Success.' != $delete_response) {
$fileoptions['status'] = 'failure';
$fileoptions_obj->save();
unset($fileoptions_obj);
return 'Send details: `' . $send_response . '`. Delete details: `' . $delete_response . '`.';
} else {
$fileoptions['status'] = 'success';
$fileoptions['finish_time'] = time();
}
$fileoptions_obj->save();
unset($fileoptions_obj);
return true;
}
示例11: _step_send_pending_files
private static function _step_send_pending_files($startAt = 0)
{
// Load state into self::$_state & fileoptions object into self::$_stateObj.
if (false === self::_load_state()) {
return false;
}
if (0 == $startAt) {
$startAt = self::$_state['stats']['last_filesend_startat'];
pb_backupbuddy::status('details', 'Starting to send pending files at position `' . $startAt . '` based on stored stats position.');
} else {
pb_backupbuddy::status('details', 'Starting to send pending files at position `' . $startAt . '` based on passed value.');
}
if (false === self::_load_catalog()) {
return false;
}
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
// Truncate log if it is getting too large. Keeps newest half.
self::_truncate_log();
// Loop through files in the catalog.
$loopCount = 0;
$checkCount = 0;
$sendTimeSum = 0;
$sendSizeSum = 0;
$sendAttemptCount = 0;
$logTruncateCheck = 0;
$lastSendThisPass = false;
$sendMoreRemain = false;
$sendAttemptCount = 0;
$lackSignatureData = 0;
$tooManyAttempts = 0;
foreach (self::$_catalog as $signatureFile => &$signatureDetails) {
$loopCount++;
if (0 != $startAt) {
// Resuming...
if ($loopCount < $startAt) {
continue;
}
}
$checkCount++;
// Every X files that get sent, make sure log file is not getting too big AND back up catalog.
if (0 == ($sendAttemptCount + 1) % 150) {
// Backup catalog.
self::backup_catalog();
}
// If already backed up OR we do not have signature data yet then skip for now.
if (0 != $signatureDetails['b'] || 0 == $signatureDetails['m']) {
if (0 == $signatureDetails['m']) {
$lackSignatureData++;
}
continue;
}
// If too many attempts have passed then skip.
if ($signatureDetails['t'] >= self::MAX_SEND_ATTEMPTS) {
$tooManyAttempts++;
continue;
}
// Load destination settings.
$destination_settings = self::get_destination_settings();
// If too many remote sends have failed today then give up for now since something is likely wrong.
if (self::$_state['stats']['recent_send_fails'] > $destination_settings['max_daily_failures']) {
$error = 'Error #5002: Too many file transfer failures have occurred so stopping transfers. We will automatically try again in 12 hours. Verify there are no remote file transfer problems. Check recently send file logs on Remote Destinations page. Don\'t want to wait? Pause Files process then select "Reset Send Attempts" under "Advanced Troubleshooting Options".';
backupbuddy_core::addNotification('live_error', 'BackupBuddy Stash Live Error', $error);
self::$_state['step']['last_status'] = $error;
pb_backupbuddy::status('error', $error);
return false;
}
// If this is not the first file we've sent this pass, see if we have enough time for more.
if ($sendSizeSum > 0) {
// Check if it appears we have enough time to send at least a full single chunk in this pass or if we need to pass off to a subsequent run.
$send_speed = $sendSizeSum / 1048576 / $sendTimeSum;
// Estimated speed at which we can send files out. Unit: MB / sec.
$time_elapsed = microtime(true) - pb_backupbuddy::$start_time;
$time_remaining = $destination_settings['max_time'] - ($time_elapsed + self::TIME_WIGGLE_ROOM);
// Estimated time remaining before PHP times out. Unit: seconds.
$size_possible_with_remaining_time = $send_speed * $time_remaining;
// Size possible to send with remaining time (takes into account wiggle room).
$size_to_send = $signatureDetails['s'] / 1048576;
// Size we want to send this pass. Unit: MB.
if ($destination_settings['max_burst'] < $size_to_send) {
// If the chunksize is smaller than the full file then cap at sending that much.
$size_to_send = $destination_settings['max_burst'];
}
if ($size_possible_with_remaining_time < $size_to_send) {
// File (or chunk) is bigger than what we have time to send.
$lastSendThisPass = true;
$sendMoreRemain = true;
$send_speed_status = 'Not enough time to send more. To continue in next live_periodic pass.';
} else {
$send_speed_status = 'Enough time to send more. Preparing for send.';
}
pb_backupbuddy::status('details', 'Not the first normal file to send this pass. Send speed: `' . $send_speed . '` MB/sec. Time elapsed: `' . $time_elapsed . '` sec. Time remaining (with wiggle): `' . $time_remaining . '` sec based on reported max time of `' . $destination_settings['max_time'] . '` sec. Size possible with remaining time: `' . $size_possible_with_remaining_time . '` MB. Size to chunk (greater of filesize or chunk): `' . $size_to_send . '` MB. Conclusion: `' . $send_speed_status . '`.');
}
// end subsequent send time check.
// NOT out of time so send this.
if (true !== $lastSendThisPass) {
// Run cleanup on send files.
require_once pb_backupbuddy::plugin_path() . '/classes/housekeeping.php';
backupbuddy_housekeeping::trim_remote_send_stats($file_prefix = 'send-live_', $limit = $destination_settings['max_send_details_limit'], '', $purge_log = true);
// Only keep last 5 send fileoptions.
// Moved into trim_remote_send_stats(). backupbuddy_housekeeping::purge_logs( $file_prefix = 'status-remote_send-live_', $limit = $destination_settings['max_send_details_limit'] ); // Only keep last 5 send logs.
//.........这里部分代码省略.........