本文整理汇总了PHP中backupbuddy_core::remoteSendRetry方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::remoteSendRetry方法的具体用法?PHP backupbuddy_core::remoteSendRetry怎么用?PHP backupbuddy_core::remoteSendRetry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::remoteSendRetry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
if ('success' == $fileoptions_obj->options['status']) {
$whyNoSend = 'This transfer is already marked as sucessfully completing.';
}
/* elseif ( 'failure' == $fileoptions_obj->options['status'] ) {
$whyNoSend = 'This transfer is marked as officially failed.';
} elseif ( -1 == $fileoptions_obj->options['finish_time'] ) {
$whyNoSend = 'This transfer is marked as cancelled.';
} */
if ('' != $whyNoSend) {
die('Error #8438483:<br><br>This send is not eligable to be resent. ' . $whyNoSend . ' Please re-initiate a send for this file manually with a fresh send.');
}
echo '<center>';
echo '<img src="' . pb_backupbuddy::plugin_url() . '/destinations/' . $fileoptions_obj->options['destinationSettings']['type'] . '/icon50.png">';
echo '<br>';
echo '<h3>Resending to "' . $fileoptions_obj->options['destinationSettings']['title'] . '"</h3>';
echo '<br>';
if (!isset($fileoptions_obj->options['destinationSettings']) || count($fileoptions_obj->options['destinationSettings']) == 0) {
echo 'This remote send does not support retrying. Please re-send manually.';
} else {
$response = backupbuddy_core::remoteSendRetry($fileoptions_obj, $send_id, 20);
// 20 is max retries allowed; it is NOT how many tries will actually be ran.
if (true === $response) {
pb_backupbuddy::alert('<b>Success</b> initiating retry attempt. It has been re-scheduled to send momentarily. Refresh the page for updates.');
} else {
pb_backupbuddy::alert('Error #238933: File has NOT been scheduled for re-sending. Manually re-send or see plugin log for details.', true);
}
}
echo '</center>';
echo '<br><br><br><br><br><hr><br><br>';
echo '<b>Troubleshooting Data (if asked for by technical support):</b><br>';
echo '<textarea style="width: 100%; height: 75%; max-height: 300px;" wrap="off" readonly="readonly">' . print_r($fileoptions_obj->options, true) . '</textarea>';
示例2: __
if (true !== ($result = $fileoptions_obj->is_ok())) {
pb_backupbuddy::status('error', __('Fatal Error #9034.32393. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
return false;
}
// Don't do anything for success, failure, or already-marked as -1 finish time.
if ('success' == $fileoptions_obj->options['status'] || 'failure' == $fileoptions_obj->options['status'] || -1 == $fileoptions_obj->options['finish_time']) {
continue;
}
// Older format did not include updated_time.
if (!isset($fileoptions_obj->options['update_time'])) {
continue;
}
$secondsAgo = time() - $fileoptions_obj->options['update_time'];
if ($secondsAgo > backupbuddy_constants::TIME_BEFORE_CONSIDERED_TIMEOUT) {
// If 24hrs passed since last update to backup then mark this timeout as failed.
$isResending = backupbuddy_core::remoteSendRetry($fileoptions_obj, $send_id, pb_backupbuddy::$options['remote_send_timeout_retries']);
if (true === $isResending) {
// If resending then skip sending any error email just yet...
continue;
}
if ('timeout' != $fileoptions_obj->options['status']) {
// Do not send email if status is 'timeout' since either already sent or old-style status marking (pre-v6.0).
// Calculate destination title and type for error email.
$destination_title = '';
$destination_type = '';
if (isset(pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']])) {
$destination_title = pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']]['title'];
$destination_type = backupbuddy_core::pretty_destination_type(pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']]['type']);
}
$error_message = 'A remote destination send of file `' . basename($fileoptions_obj->options['file']) . '` started `' . pb_backupbuddy::$format->time_ago($fileoptions_obj->options['start_time']) . '` ago sending to the destination titled `' . $destination_title . '` of type `' . $destination_type . '` likely timed out. BackupBuddy will attempt to retry this failed transfer ONCE. If the second atempt succeeds the failed attempt will be replaced in the recent sends list. Check the error log for further details and/or manually send a backup to test for problems.';
pb_backupbuddy::status('error', $error_message);
示例3: process_timed_out_sends
public static function process_timed_out_sends()
{
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
// Mark any timed out remote sends as timed out. Attempt resend once.
$remote_sends = array();
$send_fileoptions = pb_backupbuddy::$filesystem->glob_by_date(backupbuddy_core::getLogDirectory() . 'fileoptions/send-*.txt');
if (!is_array($send_fileoptions)) {
$send_fileoptions = array();
}
foreach ($send_fileoptions as $send_fileoption) {
$send_id = str_replace('.txt', '', str_replace('send-', '', basename($send_fileoption)));
pb_backupbuddy::status('details', 'About to load fileoptions data.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #23.');
$fileoptions_file = backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt';
$fileoptions_obj = new pb_backupbuddy_fileoptions($fileoptions_file, $read_only = false, $ignore_lock = false, $create_file = false);
if (true !== ($result = $fileoptions_obj->is_ok())) {
pb_backupbuddy::status('error', __('Fatal Error #9034.3224442393. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
return false;
}
// Corrupt fileoptions file. Remove.
if (!isset($fileoptions_obj->options['start_time'])) {
unset($fileoptions_obj);
@unlink($fileoptions_file);
continue;
}
// Finish time not set. Shouldn't happen buuuuut.... skip.
if (!isset($fileoptions_obj->options['finish_time'])) {
continue;
}
// Don't do anything for success, failure, or already-marked as -1 finish time.
if ('success' == $fileoptions_obj->options['status'] || 'failure' == $fileoptions_obj->options['status'] || -1 == $fileoptions_obj->options['finish_time']) {
continue;
}
// Older format did not include updated_time.
if (!isset($fileoptions_obj->options['update_time'])) {
continue;
}
$secondsAgo = time() - $fileoptions_obj->options['update_time'];
if ($secondsAgo > backupbuddy_constants::TIME_BEFORE_CONSIDERED_TIMEOUT) {
// If 24hrs passed since last update to backup then mark this timeout as failed.
// Potentially try to resend if not a live_periodic transfer.
if ('live_periodic' != $fileoptions_obj->options['trigger']) {
$isResending = backupbuddy_core::remoteSendRetry($fileoptions_obj, $send_id, pb_backupbuddy::$options['remote_send_timeout_retries']);
if (true === $isResending) {
// If resending then skip sending any error email just yet...
continue;
}
if ('timeout' != $fileoptions_obj->options['status']) {
// Do not send email if status is 'timeout' since either already sent or old-style status marking (pre-v6.0).
// Calculate destination title and type for error email.
$destination_title = '';
$destination_type = '';
if (isset(pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']])) {
$destination_title = pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']]['title'];
$destination_type = backupbuddy_core::pretty_destination_type(pb_backupbuddy::$options['remote_destinations'][$fileoptions_obj->options['destination']]['type']);
}
$error_message = 'A remote destination send of file `' . basename($fileoptions_obj->options['file']) . '` started `' . pb_backupbuddy::$format->time_ago($fileoptions_obj->options['start_time']) . '` ago sending to the destination titled `' . $destination_title . '` of type `' . $destination_type . '` likely timed out. BackupBuddy will attempt to retry this failed transfer ONCE. If the second atempt succeeds the failed attempt will be replaced in the recent sends list. Check the error log for further details and/or manually send a backup to test for problems.';
pb_backupbuddy::status('error', $error_message);
if ($secondsAgo < backupbuddy_constants::CLEANUP_MAX_AGE_TO_NOTIFY_TIMEOUT) {
// Prevents very old timed out backups from triggering email send.
backupbuddy_core::mail_error($error_message);
}
}
}
// Save as timed out.
$fileoptions_obj->options['status'] = 'timeout';
$fileoptions_obj->options['finish_time'] = -1;
$fileoptions_obj->save();
// If live_periofic then just try to delete the file at this point.
if ('live_periodic' == $fileoptions_obj->options['trigger']) {
unset($fileoptions_obj);
@unlink($fileoptions_file);
continue;
}
}
unset($fileoptions_obj);
}
}