本文整理汇总了PHP中BackWPup_Job::start_http方法的典型用法代码示例。如果您正苦于以下问题:PHP BackWPup_Job::start_http方法的具体用法?PHP BackWPup_Job::start_http怎么用?PHP BackWPup_Job::start_http使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackWPup_Job
的用法示例。
在下文中一共展示了BackWPup_Job::start_http方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cron_active
/**
* Start job if in cron and run query args are set.
*/
public static function cron_active()
{
//only if cron active
if (!defined('DOING_CRON') || !DOING_CRON) {
return;
}
//only work if backwpup_run as query var ist set and nothing else and the value ist right
if (empty($_GET['backwpup_run']) || !in_array($_GET['backwpup_run'], array('test', 'restart', 'runnow', 'runnowalt', 'runext', 'cronrun'))) {
return;
}
//special header
@session_write_close();
@header('Content-Type: text/html; charset=' . get_bloginfo('charset'), TRUE);
@header('X-Robots-Tag: noindex, nofollow', TRUE);
@header('X-BackWPup-Version: ' . BackWPup::get_plugin_data('version'), TRUE);
nocache_headers();
//on test die for fast feedback
if ($_GET['backwpup_run'] == 'test') {
die('BackWPup Test');
}
// generate normal nonce
$nonce = substr(wp_hash(wp_nonce_tick() . 'backwpup_job_run-' . $_GET['backwpup_run'], 'nonce'), -12, 10);
//special nonce on external start
if ($_GET['backwpup_run'] == 'runext') {
$nonce = get_site_option('backwpup_cfg_jobrunauthkey');
}
// check nonce
if (empty($_GET['_nonce']) || $nonce != $_GET['_nonce']) {
return;
}
//check runext is allowed for job
if ($_GET['backwpup_run'] == 'runext') {
$jobids_external = BackWPup_Option::get_job_ids('activetype', 'link');
if (!isset($_GET['jobid']) || !in_array($_GET['jobid'], $jobids_external)) {
return;
}
}
//run BackWPup job
BackWPup_Job::start_http($_GET['backwpup_run']);
die;
}
示例2: cron_active
/**
* Start job if in cron and run query args are set.
*/
public static function cron_active($args = array())
{
//only if cron active
if (!defined('DOING_CRON') || !DOING_CRON) {
return;
}
if (isset($_GET['backwpup_run'])) {
$args['run'] = sanitize_text_field($_GET['backwpup_run']);
}
if (isset($_GET['_nonce'])) {
$args['nonce'] = sanitize_text_field($_GET['_nonce']);
}
if (isset($_GET['jobid'])) {
$args['jobid'] = absint($_GET['jobid']);
}
$args = array_merge(array('run' => '', 'nonce' => '', 'jobid' => 0), $args);
if (!in_array($args['run'], array('test', 'restart', 'runnow', 'runnowalt', 'runext', 'cronrun'), true)) {
return;
}
//special header
@session_write_close();
@header('Content-Type: text/html; charset=' . get_bloginfo('charset'), true);
@header('X-Robots-Tag: noindex, nofollow', true);
nocache_headers();
//on test die for fast feedback
if ($args['run'] === 'test') {
die('BackWPup test request');
}
if ($args['run'] === 'restart') {
$job_object = BackWPup_Job::get_working_data();
//restart job if not working or a restart wished
$not_worked_time = microtime(TRUE) - $job_object->timestamp_last_update;
if (!$job_object->pid || $not_worked_time > 300) {
BackWPup_Job::start_http('restart');
return;
}
}
// generate normal nonce
$nonce = substr(wp_hash(wp_nonce_tick() . 'backwpup_job_run-' . $args['run'], 'nonce'), -12, 10);
//special nonce on external start
if ($args['run'] === 'runext') {
$nonce = get_site_option('backwpup_cfg_jobrunauthkey');
}
if ($args['run'] === 'cronrun') {
$nonce = '';
}
// check nonce
if ($nonce !== $args['nonce']) {
return;
}
//check runext is allowed for job
if ($args['run'] === 'runext') {
$jobids_link = BackWPup_Option::get_job_ids('activetype', 'link');
$jobids_easycron = BackWPup_Option::get_job_ids('activetype', 'easycron');
$jobids_external = array_merge($jobids_link, $jobids_easycron);
if (!in_array($args['jobid'], $jobids_external, true)) {
return;
}
}
//run BackWPup job
BackWPup_Job::start_http($args['run'], $args['jobid']);
}