Beispiel #1
0
 public static function _run_remote_snapshot($trigger = 'unknown')
 {
     if (false === self::_load_state()) {
         return false;
     }
     $destination_settings = backupbuddy_live_periodic::get_destination_settings();
     // Send email notification?
     if ('1' == $destination_settings['send_snapshot_notification'] || 0 == self::$_state['stats']['first_completion']) {
         // Email notification enabled _OR_ it's the first snapshot for this site.
         if ('' != $destination_settings['email']) {
             $email = $destination_settings['email'];
         } else {
             pb_backupbuddy::status('details', 'Snapshot set to send email notification to account. Send notification?: `' . $destination_settings['send_snapshot_notification'] . '`. First completion: `' . self::$_state['stats']['first_completion'] . '`.');
             $email = 'account';
         }
     } else {
         pb_backupbuddy::status('details', 'Snapshot set not to send email notification.');
         $email = 'none';
     }
     $additionalParams = array('ibpass' => '', 'email' => $email, 'stash_copy' => true, 'trim' => backupbuddy_live::get_archive_limit_settings_array(false));
     if ('' != pb_backupbuddy::$options['importbuddy_pass_hash']) {
         $additionalParams['ibpass'] = pb_backupbuddy::$options['importbuddy_pass_hash'];
     }
     if (false !== ($timezone = self::tz_offset_to_name(get_option('gmt_offset')))) {
         $additionalParams['timezone'] = $timezone;
     }
     require_once pb_backupbuddy::plugin_path() . '/destinations/live/init.php';
     $response = pb_backupbuddy_destination_live::stashAPI($destination_settings, 'live-snapshot', $additionalParams, $blocking = true, $passthru_errors = true);
     self::$_state['stats']['last_remote_snapshot_trigger'] = $trigger;
     self::$_state['stats']['last_remote_snapshot_response'] = $response;
     self::$_state['stats']['last_remote_snapshot_response_time'] = microtime(true);
     self::$_state['stats']['manual_snapshot'] = false;
     // Set false no matter what.
     if (pb_backupbuddy::$options['log_level'] == '3') {
         // Full logging enabled.
         pb_backupbuddy::status('details', 'live-snapshot response due to logging level: `' . print_r($response, true) . '`. Call params: `' . print_r($additionalParams, true) . ' `.');
     }
     do_action('backupbuddy_run_remote_snapshot_response', $response);
     return $response;
 }