本文整理匯總了PHP中BackWPup_Job::start_wp_cron方法的典型用法代碼示例。如果您正苦於以下問題:PHP BackWPup_Job::start_wp_cron方法的具體用法?PHP BackWPup_Job::start_wp_cron怎麽用?PHP BackWPup_Job::start_wp_cron使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BackWPup_Job
的用法示例。
在下文中一共展示了BackWPup_Job::start_wp_cron方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
/**
* @static
*
* @param $arg
* @internal param $args
*/
public static function run($arg)
{
$job_object = BackWPup_Job::get_working_data();
if ($arg == 'restart' && !empty($job_object)) {
//reschedule restart
wp_schedule_single_event(time() + 60, 'backwpup_cron', array('id' => 'restart'));
//restart job if not working or a restart imitated
$not_worked_time = microtime(TRUE) - $job_object->timestamp_last_update;
if (empty($job_object->pid) || $not_worked_time > 300) {
BackWPup_Job::start_wp_cron();
}
return;
}
if (empty($arg) || $arg == 'restart') {
return;
}
//check that job exits
$jobids = BackWPup_Option::get_job_ids('activetype', 'wpcron');
if (!in_array($arg, $jobids)) {
return;
}
//delay other job start for 5 minutes if already one is running
if (!empty($job_object)) {
wp_schedule_single_event(time() + 300, 'backwpup_cron', array('id' => $arg));
return;
}
//reschedule next job run
$cron_next = self::cron_next(BackWPup_Option::get($arg, 'cron'));
wp_schedule_single_event($cron_next, 'backwpup_cron', array('id' => $arg));
//start job
BackWPup_Job::start_wp_cron($arg);
}