<?php // Incoming vars: $pause_continuous, $pause_periodic, $start_run. require_once pb_backupbuddy::plugin_path() . '/destinations/live/live.php'; if (false === ($destination_id = backupbuddy_live::getLiveID())) { // $destination_id used by _stats.php. return false; } $saving = false; /***** BEGIN CONTINOUS *****/ if (false === $pause_continuous) { // Unpause. pb_backupbuddy::$options['remote_destinations'][$destination_id]['pause_continuous'] = '0'; $saving = true; } elseif (true === $pause_continuous) { // Pause. pb_backupbuddy::$options['remote_destinations'][$destination_id]['pause_continuous'] = '1'; $saving = true; } /***** END CONTINOUS *****/ /***** BEGIN PERIODIC *****/ if (false === $pause_periodic) { // Unpause. $prior_periodic_status = pb_backupbuddy::$options['remote_destinations'][$destination_id]['pause_periodic']; pb_backupbuddy::$options['remote_destinations'][$destination_id]['pause_periodic'] = '0'; if ('1' == $prior_periodic_status) { // Was paused, now unpaused, so check if we need to run now. if (true === $start_run) { pb_backupbuddy::save(); // Must save prior to spawning. $cronArgs = array();
<?php backupbuddy_core::verifyAjaxAccess(); pb_backupbuddy::$ui->ajax_header($js = true, $padding = false); require_once pb_backupbuddy::plugin_path() . '/destinations/live/live_periodic.php'; require_once pb_backupbuddy::plugin_path() . '/destinations/live/live.php'; $destination_id = backupbuddy_live::getLiveID(); $destination = backupbuddy_live_periodic::get_destination_settings(); $hide_quota = true; $live_mode = true; require_once pb_backupbuddy::plugin_path() . '/destinations/stash2/init.php'; require_once pb_backupbuddy::plugin_path() . '/destinations/stash2/_manage.php'; pb_backupbuddy::$ui->ajax_footer($js_common = true);
public static function get_destination_settings() { require_once pb_backupbuddy::plugin_path() . '/classes/core.php'; require_once pb_backupbuddy::plugin_path() . '/destinations/live/init.php'; $settings = pb_backupbuddy_destination_live::_formatSettings(pb_backupbuddy::$options['remote_destinations'][backupbuddy_live::getLiveID()]); if ('' == $settings['max_time']) { $settings['max_time'] = backupbuddy_core::adjustedMaxExecutionTime(); } return $settings; }
public static function run_live_send() { if (true === self::$_queue_sent) { // Already sent. Shutdown fired again. return; } pb_backupbuddy::flush(); // Send any pending data to browser. if (!isset(pb_backupbuddy::$options['remote_destinations'][backupbuddy_live::getLiveID()])) { // Live destination went away. Deleted? return; } $count = self::_process_dbqueue(); if (0 == $count) { // Nothing needs to be sent. return; } self::_send_dbqueue(); }
echo json_encode($stats); // If there is more to do and too long of time has passed since activity then try to jumpstart the process at the beginning. if ((0 == $stats['files_total'] || $stats['files_sent'] < $stats['files_total']) && 'wait_on_transfers' != $stats['current_function']) { // ( Files to send not yet calculated OR more remain to send ) AND not on the wait_on_transfers step. $time_since_last_activity = microtime(true) - $stats['last_periodic_activity']; if ($time_since_last_activity < 30) { // Don't even bother getting max execution time if it's been less than 30 seconds since run. // do nothing } else { // More than 30 seconds since last activity. // Detect max PHP execution time. If TESTED value is higher than PHP value then go with that since we want to err on not overlapping processes here. $detected_execution = backupbuddy_core::detectLikelyHighestExecutionTime(); if ($time_since_last_activity > $detected_execution + backupbuddy_constants::TIMED_OUT_PROCESS_RESUME_WIGGLE_ROOM) { // Enough time has passed to assume timed out. require_once pb_backupbuddy::plugin_path() . '/destinations/live/live.php'; if (false === ($liveID = backupbuddy_live::getLiveID())) { die('-1'); } if ('1' != pb_backupbuddy::$options['remote_destinations'][$liveID]['pause_periodic']) { // Only proceed if NOT paused. pb_backupbuddy::status('warning', 'BackupBuddy Stash Live process appears timed out while user it viewing Live page. Forcing run now.'); $cronArgs = array(); $schedule_result = backupbuddy_core::schedule_single_event(time(), 'live_periodic', $cronArgs); if (true === $schedule_result) { pb_backupbuddy::status('details', 'Next Live Periodic chunk step cron event scheduled.'); } else { pb_backupbuddy::status('error', 'Next Live Periodic chunk step cron event FAILED to be scheduled.'); } if ('1' != pb_backupbuddy::$options['skip_spawn_cron_call']) { pb_backupbuddy::status('details', 'Spawning cron now.'); update_option('_transient_doing_cron', 0);