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


PHP _set_cron_array函数代码示例

本文整理汇总了PHP中_set_cron_array函数的典型用法代码示例。如果您正苦于以下问题:PHP _set_cron_array函数的具体用法?PHP _set_cron_array怎么用?PHP _set_cron_array使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_set_cron_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wp33423_hotfix

function wp33423_hotfix()
{
    global $wp_version;
    /**
     * Disable this plugin from 4.3.1
     */
    if (1 !== version_compare("4.3.1", $wp_version) && current_user_can('activate_plugins')) {
        deactivate_plugins(plugin_basename(__FILE__));
    }
    /**
     * Prevent 4.3 from messing up the cron array and options table
     */
    remove_action('admin_init', '_wp_check_for_scheduled_split_terms');
    /**
     * Clean the cron array after 4.3 messed it up
     */
    $cron_array = _get_cron_array();
    if (isset($cron_array['wp_batch_split_terms'])) {
        unset($cron_array['wp_batch_split_terms']);
        _set_cron_array($cron_array);
    }
    /**
     * In order to avoid the wp_batch_split_terms() job being accidentally removed,
     * check that it's still scheduled while we haven't finished splitting terms.
     */
    if (!get_option('finished_splitting_shared_terms') && !wp_next_scheduled('wp_split_shared_term_batch')) {
        wp_schedule_single_event(time() + MINUTE_IN_SECONDS, 'wp_split_shared_term_batch');
    }
}
开发者ID:peterwilsoncc,项目名称:wp33423-hotfix,代码行数:29,代码来源:wp33423-hotfix.php

示例2: pmpro_upgrade_1_8_7

function pmpro_upgrade_1_8_7()
{
    //fix cron jobs
    $jobs = _get_cron_array();
    // Remove all pmpro cron jobs (for now).
    foreach ($jobs as $when => $job_array) {
        foreach ($job_array as $name => $job) {
            //delete pmpro cron
            if (false !== stripos($name, 'pmpro_cron')) {
                unset($jobs[$when][$name]);
            }
        }
        //delete empty cron time slots
        if (empty($jobs[$when])) {
            unset($jobs[$when]);
        }
    }
    // Save the data
    _set_cron_array($jobs);
    //add the three we want back
    pmpro_maybe_schedule_event(current_time('timestamp'), 'daily', 'pmpro_cron_expire_memberships');
    pmpro_maybe_schedule_event(current_time('timestamp') + 1, 'daily', 'pmpro_cron_expiration_warnings');
    pmpro_maybe_schedule_event(current_time('timestamp'), 'monthly', 'pmpro_cron_credit_card_expiring_warnings');
    pmpro_setOption("db_version", "1.87");
    return 1.87;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:26,代码来源:upgrade_1_8_7.php

示例3: setUp

 function setUp()
 {
     parent::setUp();
     wp_set_current_user(self::$editor_id);
     _set_cron_array(array());
     $this->post_ids = array();
 }
开发者ID:pbearne,项目名称:contrib2core,代码行数:7,代码来源:post.php

示例4: setUp

	function setUp() {
		parent::setUp();
		$this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
		$this->old_current_user = get_current_user_id();
		wp_set_current_user( $this->author_id );
		_set_cron_array(array());
		$this->post_ids = array();
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:8,代码来源:post.php

示例5: wp_unschedule_event

function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
	$crons = _get_cron_array();
	$key = md5(serialize($args));
	unset( $crons[$timestamp][$hook][$key] );
	if ( empty($crons[$timestamp][$hook]) )
		unset( $crons[$timestamp][$hook] );
	if ( empty($crons[$timestamp]) )
		unset( $crons[$timestamp] );
	_set_cron_array( $crons );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:10,代码来源:cron.php

示例6: remove_schedules

 /** Remove all schedules */
 public function remove_schedules()
 {
     $cron = _get_cron_array();
     foreach ($cron as $timestamp => $schedule) {
         if (!isset($schedule['gf_digest_send_notifications'])) {
             continue;
         }
         unset($cron[$timestamp]['gf_digest_send_notifications']);
         if (empty($cron[$timestamp])) {
             unset($cron[$timestamp]);
         }
     }
     _set_cron_array($cron);
 }
开发者ID:hansstam,项目名称:makerfaire,代码行数:15,代码来源:gravityforms-digest.php

示例7: unschedule_event

 /**
  * Unschedule an event by hook name
  *
  * @see https://core.trac.wordpress.org/ticket/18997#comment:23
  * @since 1.0.5
  * @return void
  */
 public static function unschedule_event($hook)
 {
     $crons = _get_cron_array();
     if (empty($crons)) {
         return;
     }
     foreach ($crons as $timestamp => $cron) {
         if (!empty($cron[$hook])) {
             unset($crons[$timestamp][$hook]);
         }
         if (empty($crons[$timestamp])) {
             unset($crons[$timestamp]);
         }
     }
     _set_cron_array($crons);
 }
开发者ID:4ley,项目名称:querywall,代码行数:23,代码来源:class-qwall-util.php

示例8: clear

 public static function clear($hook)
 {
     $crons = _get_cron_array();
     if (empty($crons)) {
         return;
     }
     foreach ($crons as $timestamp => $cron) {
         if (!empty($cron[$hook])) {
             unset($crons[$timestamp][$hook]);
             // Unset empty timestamps
             if (empty($crons[$timestamp])) {
                 unset($crons[$timestamp]);
             }
         }
     }
     return _set_cron_array($crons);
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:17,代码来源:class-ai1wm-cron.php

示例9: upgrade_hooks

 /**
  * Update subscription WP-Cron tasks to Action Scheduler.
  *
  * @since 2.0
  */
 public static function upgrade_hooks($number_hooks_to_upgrade)
 {
     $counter = 0;
     $cron = _get_cron_array();
     foreach ($cron as $timestamp => $actions) {
         foreach ($actions as $hook => $details) {
             if ('scheduled_subscription_payment' == $hook || 'scheduled_subscription_expiration' == $hook || 'scheduled_subscription_end_of_prepaid_term' == $hook || 'scheduled_subscription_trial_end' == $hook || 'paypal_check_subscription_payment' == $hook) {
                 foreach ($details as $hook_key => $values) {
                     if (!wc_next_scheduled_action($hook, $values['args'])) {
                         wc_schedule_single_action($timestamp, $hook, $values['args']);
                         unset($cron[$timestamp][$hook][$hook_key]);
                         $counter++;
                     }
                     if ($counter >= $number_hooks_to_upgrade) {
                         break;
                     }
                 }
                 // If there are no other jobs scheduled for this hook at this timestamp, remove the entire hook
                 if (0 == count($cron[$timestamp][$hook])) {
                     unset($cron[$timestamp][$hook]);
                 }
                 if ($counter >= $number_hooks_to_upgrade) {
                     break;
                 }
             }
         }
         // If there are no actions schedued for this timestamp, remove the entire schedule
         if (0 == count($cron[$timestamp])) {
             unset($cron[$timestamp]);
         }
         if ($counter >= $number_hooks_to_upgrade) {
             break;
         }
     }
     // Set the cron with the removed schedule
     _set_cron_array($cron);
     return $counter;
 }
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:43,代码来源:class-wcs-upgrade-1-5.php

示例10: tearDown

 function tearDown()
 {
     parent::tearDown();
     // make sure the schedule is clear
     _set_cron_array(array());
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:6,代码来源:cron.php

示例11: cron_schedule_single_event

 /**
  * @param int $timestamp Timestamp for when to run the event.
  * @param string $hook Action hook to execute when cron is run.
  * @param array $args Optional. Arguments to pass to the hook's callback function.
  */
 public function cron_schedule_single_event($timestamp, $hook, $args = array())
 {
     // don't schedule a duplicate if there's already an identical event due in the next 10 minutes
     $next = cron_next_scheduled($hook, $args);
     if ($next && $next <= $timestamp + 600) {
         return;
     }
     $crons = _get_cron_array();
     $key = md5(serialize($args));
     $crons[$timestamp][$hook][$key] = array('schedule' => false, 'args' => $args);
     uksort($crons, "strnatcasecmp");
     _set_cron_array($crons);
 }
开发者ID:shibuya246,项目名称:Hotaru-Plugins,代码行数:18,代码来源:cron.php

示例12: refresh_cron

 static function refresh_cron()
 {
     if (!extension_loaded('suhosin')) {
         @ini_set('memory_limit', -1);
     }
     // Remove all cron jobs created by NextGEN Gallery
     $cron = _get_cron_array();
     if (is_array($cron)) {
         foreach ($cron as $timestamp => $job) {
             if (is_array($job)) {
                 unset($cron[$timestamp]['ngg_delete_expired_transients']);
                 if (empty($cron[$timestamp])) {
                     unset($cron[$timestamp]);
                 }
             }
         }
     }
     _set_cron_array($cron);
 }
开发者ID:kixortillan,项目名称:dfosashworks,代码行数:19,代码来源:class.photocrati_installer.php

示例13: _clean_cron_array

 /**
  *
  *
  * @desc Clean cron array
  */
 private function _clean_cron_array()
 {
     //retrive all crons
     $crons = _get_cron_array();
     if (!is_array($crons)) {
         return;
     }
     $local_time = microtime(true);
     $doing_wp_cron = sprintf('%.22F', $local_time);
     set_transient('doing_cron', $doing_wp_cron);
     foreach ($crons as $timestamp => $cronhooks) {
         foreach ($cronhooks as $hook => $keys) {
             if ($hook == $this->_hook) {
                 unset($crons[$timestamp][$hook]);
             }
         }
         if (empty($crons[$timestamp])) {
             unset($crons[$timestamp]);
         }
     }
     //update cron with new array
     _set_cron_array($crons);
     delete_transient('doing_cron');
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:29,代码来源:class-cron.php

示例14: gd_unschedule_event

/**
 * Unschedule a previously scheduled cron job using job key.
 *
 * @param int $timestamp timestamp for when to run the event.
 * @param string $hook action hook, the execution of which will be unscheduled.
 * @param string $key key for arguments to identify the event.
 */
function gd_unschedule_event($timestamp, $hook, $key)
{
    $crons = _get_cron_array();
    unset($crons[$timestamp][$hook][$key]);
    if (empty($crons[$timestamp][$hook])) {
        unset($crons[$timestamp][$hook]);
    }
    if (empty($crons[$timestamp])) {
        unset($crons[$timestamp]);
    }
    _set_cron_array($crons);
}
开发者ID:hewu,项目名称:blogwp,代码行数:19,代码来源:functions.php

示例15: wp_unschedule_event

/**
 * Unschedule a previously scheduled cron job.
 *
 * The $timestamp and $hook parameters are required, so that the event can be
 * identified.
 *
 * @since 2.1.0
 *
 * @param int $timestamp Timestamp for when to run the event.
 * @param string $hook Action hook, the execution of which will be unscheduled.
 * @param array $args Arguments to pass to the hook's callback function.
 * Although not passed to a callback function, these arguments are used
 * to uniquely identify the scheduled event, so they should be the same
 * as those used when originally scheduling the event.
 * @return false|void False when an event is not unscheduled.
 */
function wp_unschedule_event($timestamp, $hook, $args = array())
{
    // Make sure timestamp is a positive integer
    if (!is_numeric($timestamp) || $timestamp <= 0) {
        return false;
    }
    $crons = _get_cron_array();
    $key = md5(serialize($args));
    unset($crons[$timestamp][$hook][$key]);
    if (empty($crons[$timestamp][$hook])) {
        unset($crons[$timestamp][$hook]);
    }
    if (empty($crons[$timestamp])) {
        unset($crons[$timestamp]);
    }
    _set_cron_array($crons);
}
开发者ID:Born1988,项目名称:WordPress,代码行数:33,代码来源:cron.php


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