当前位置: 首页>>代码示例>>PHP>>正文


PHP BackWPup_Job::start_http方法代码示例

本文整理汇总了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;
 }
开发者ID:congtrieu112,项目名称:anime,代码行数:44,代码来源:class-cron.php

示例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']);
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:65,代码来源:class-cron.php


注:本文中的BackWPup_Job::start_http方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。