function run_schedule()
 {
     $schedule_id = $this->check_schedule();
     HM\BackUpWordPress\Path::get_instance()->cleanup();
     // Fixes an issue on servers which only allow a single session per client
     session_write_close();
     $task = new \HM\Backdrop\Task('hmbkp_run_schedule_async', $schedule_id);
     $task->schedule();
     $schedule = new HM\BackUpWordPress\Scheduled_Backup(sanitize_text_field(urldecode($schedule_id)));
     $information['scheduleStatus'] = $schedule->get_status();
     $information['file_size_text'] = $this->hmbkp_get_site_size_text($schedule);
     $information['started_ago'] = human_time_diff($schedule->get_schedule_running_start_time());
     return array('result' => 'SUCCESS');
 }
Exemplo n.º 2
0
/**
 * Display the row of actions for a schedule
 *
 * @access public
 * @param HM\BackUpWordPress\Scheduled_Backup $schedule
 * @return void
 */
function hmbkp_schedule_status(HM\BackUpWordPress\Scheduled_Backup $schedule, $echo = true)
{
    ob_start();
    ?>

	<span class="hmbkp-status"<?php 
    if ($schedule->get_status()) {
        ?>
 title="<?php 
        printf(__('Started %s ago', 'backupwordpress'), human_time_diff($schedule->get_schedule_running_start_time()));
        ?>
"<?php 
    }
    ?>
>
		<?php 
    echo $schedule->get_status() ? wp_kses_data($schedule->get_status()) : __('Starting Backup', 'backupwordpress');
    ?>
		<a href="<?php 
    echo hmbkp_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;
}
Exemplo n.º 3
0
/**
 * Display the running status via ajax
 */
function hmbkp_ajax_is_backup_in_progress()
{
    check_ajax_referer('hmbkp_nonce', 'nonce');
    if (empty($_POST['hmbkp_schedule_id'])) {
        die;
    }
    $schedule = new HM\BackUpWordPress\Scheduled_Backup(sanitize_text_field(urldecode($_POST['hmbkp_schedule_id'])));
    if (!$schedule->get_status()) {
        echo 0;
    } else {
        hmbkp_schedule_status($schedule);
    }
    die;
}