コード例 #1
0
ファイル: class-service.php プロジェクト: nvillapiano/Xina
 /**
  * Gets the settings for a similar destination from the existing schedules
  * so that we can copy them into the form to avoid having to type them again
  *
  * @return array
  */
 protected function fetch_destination_settings()
 {
     $service = $this->get_slug();
     $schedules_obj = Schedules::get_instance();
     $schedules = $schedules_obj->get_schedules();
     foreach ($schedules as $schedule) {
         if ($schedule->get_id() != $this->schedule->get_id()) {
             $options = $schedule->get_service_options($service);
             if (!empty($options)) {
                 return $options;
             }
         }
     }
     return array();
 }
コード例 #2
0
ファイル: interface.php プロジェクト: domalexxx/nashvancouver
/**
 * Display the row of actions for a schedule
 *
 * @access public
 * @param Scheduled_Backup $schedule
 * @return void
 */
function schedule_status(Scheduled_Backup $schedule, $echo = true)
{
    $status = new Backup_Status($schedule->get_id());
    ob_start();
    ?>

	<span class="hmbkp-status"<?php 
    if ($status->get_status()) {
        ?>
 title="<?php 
        printf(__('Started %s ago', 'backupwordpress'), human_time_diff($status->get_start_time()));
        ?>
"<?php 
    }
    ?>
>
		<?php 
    echo $status->get_status() ? wp_kses_data($status->get_status()) : __('Starting backup...', 'backupwordpress');
    ?>
		<a href="<?php 
    echo admin_action_url('request_cancel_backup', array('hmbkp_schedule_id' => $schedule->get_id()));
    ?>
"><?php 
    _e('cancel', 'backupwordpress');
    ?>
</a>
	</span>

	<?php 
    $output = ob_get_clean();
    if (!$echo) {
        return $output;
    }
    echo $output;
}
コード例 #3
0
ファイル: actions.php プロジェクト: crazyyy/bessarabia
/**
 * Receive the heartbeat and return backup status
 */
function heartbeat_received($response, $data)
{
    $response['heartbeat_interval'] = 'fast';
    if (!empty($data['hmbkp_schedule_id'])) {
        $schedule = new Scheduled_Backup(sanitize_text_field(urldecode($data['hmbkp_schedule_id'])));
        $status = new Backup_Status($schedule->get_id());
        if (!empty($data['hmbkp_is_in_progress'])) {
            if (!$status->get_status()) {
                $response['hmbkp_schedule_status'] = 0;
                // Slow the heartbeat back down
                $response['heartbeat_interval'] = 'slow';
            } else {
                $response['hmbkp_schedule_status'] = schedule_status($schedule, false);
            }
        }
        if (!empty($data['hmbkp_client_request'])) {
            $site_size = new Site_Size($schedule->get_type(), $schedule->get_excludes());
            // Pass the site size to be displayed when it's ready.
            if ($site_size->is_site_size_cached()) {
                $response['hmbkp_site_size'] = $site_size->get_formatted_site_size();
                ob_start();
                require HMBKP_PLUGIN_PATH . 'admin/schedule-form-excludes.php';
                $response['hmbkp_dir_sizes'] = ob_get_clean();
                // Slow the heartbeat back down
                $response['heartbeat_interval'] = 'slow';
            }
        }
    }
    return $response;
}