예제 #1
0
파일: cron.php 프로젝트: nxtclass/NXTClass
/**
 * Unschedule all cron jobs attached to a specific hook.
 *
 * @since 2.1.0
 *
 * @param string $hook Action hook, the execution of which will be unscheduled.
 * @param array $args Optional. Arguments that were to be pass to the hook's callback function.
 */
function nxt_clear_scheduled_hook($hook, $args = array())
{
    // Backward compatibility
    // Previously this function took the arguments as discrete vars rather than an array like the rest of the API
    if (!is_array($args)) {
        _deprecated_argument(__FUNCTION__, '3.0', __('This argument has changed to an array to match the behavior of the other cron functions.'));
        $args = array_slice(func_get_args(), 1);
    }
    while ($timestamp = nxt_next_scheduled($hook, $args)) {
        nxt_unschedule_event($timestamp, $hook, $args);
    }
}
예제 #2
0
 * Tell bbPress we are doing the CRON task.
 *
 * @var bool
 */
define('DOING_CRON', true);
/** Setup bbPress environment */
require_once './bb-load.php';
if (false === ($crons = _get_cron_array())) {
    die;
}
$keys = array_keys($crons);
$local_time = time();
if (!is_array($crons) || isset($keys[0]) && $keys[0] > $local_time) {
    die;
}
foreach ($crons as $timestamp => $cronhooks) {
    if ($timestamp > $local_time) {
        break;
    }
    foreach ($cronhooks as $hook => $keys) {
        foreach ($keys as $key => $args) {
            $schedule = $args['schedule'];
            if ($schedule != false) {
                $new_args = array($timestamp, $schedule, $hook, $args['args']);
                call_user_func_array('nxt_reschedule_event', $new_args);
            }
            nxt_unschedule_event($timestamp, $hook, $args['args']);
            do_action_ref_array($hook, $args['args']);
        }
    }
}
예제 #3
0
/**
 * Unschedule all cron jobs attached to a specific hook.
 *
 * @since 2.1.0
 *
 * @param string $hook Action hook, the execution of which will be unscheduled.
 * @param array $args Optional. Arguments that were to be pass to the hook's callback function.
 */
function nxt_clear_scheduled_hook($hook, $args = array())
{
    // Backward compatibility
    // Previously this function took the arguments as discrete vars rather than an array like the rest of the API
    if (!is_array($args)) {
        $args = array_slice(func_get_args(), 1);
    }
    while ($timestamp = nxt_next_scheduled($hook, $args)) {
        nxt_unschedule_event($timestamp, $hook, $args);
    }
}