本文整理汇总了PHP中_get_cron_array函数的典型用法代码示例。如果您正苦于以下问题:PHP _get_cron_array函数的具体用法?PHP _get_cron_array怎么用?PHP _get_cron_array使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_get_cron_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_cron
function do_cron()
{
# Lifted from wp-cron.php because it can't handle multiple blogs
if (false === ($crons = _get_cron_array())) {
print "no crons.\n";
return;
}
$keys = array_keys($crons);
$local_time = time();
if (isset($keys[0]) && $keys[0] > $local_time) {
print "not yet time.\n";
return;
}
foreach ($crons as $timestamp => $cronhooks) {
if ($timestamp > $local_time) {
break;
}
foreach ($cronhooks as $hook => $keys) {
foreach ($keys as $k => $v) {
$schedule = $v['schedule'];
if ($schedule != false) {
$new_args = array($timestamp, $schedule, $hook, $v['args']);
call_user_func_array('wp_reschedule_event', $new_args);
}
wp_unschedule_event($timestamp, $hook, $v['args']);
print $hook . "... ";
do_action_ref_array($hook, $v['args']);
}
}
}
# /end lifted from wp-cron.php
}
示例2: 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');
}
}
示例3: 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;
}
示例4: wp_jp_scl_scheduled_crons_widget_function
function wp_jp_scl_scheduled_crons_widget_function()
{
$crons = _get_cron_array();
echo '<ul>';
foreach ($crons as $key => $value) {
_e('<li><strong>' . key($value) . '</strong> será executado em <strong>' . date("H:i:s d/m/Y", $key + 3600 * get_option('gmt_offset')) . '</strong></li>', 'simple-cron-listing');
}
echo '</ul>';
}
示例5: test_remove_all_schedules
/** Stray schedules after an update/install will spoil everything */
public function test_remove_all_schedules()
{
wp_schedule_event(1, 'minute', 'gf_digest_send_notifications', array('unknown'));
wp_schedule_event(2, 'hourly', 'gf_digest_send_notifications', array(1));
$this->digest->remove_schedules();
foreach (_get_cron_array() as $schedule) {
$this->assertArrayNotHasKey('gf_digest_send_notifications', $schedule);
}
}
示例6: amen_unschedule_crons
function amen_unschedule_crons()
{
$crons = _get_cron_array();
foreach ($crons as $time => $cron_data) {
foreach ($cron_data as $cron_event => $data) {
'amenemailprayers' == $cron_event ? wp_unschedule_event($time, $cron_event) : FALSE;
}
}
}
示例7: ai1ec_uninstall_crons
/**
* unregister our CRON
*/
function ai1ec_uninstall_crons()
{
foreach (_get_cron_array() as $time => $cron) {
foreach ($cron as $name => $args) {
if (substr($name, 0, 6) === 'ai1ec_') {
wp_clear_scheduled_hook($name);
}
}
}
}
示例8: parse_crons
public function parse_crons()
{
foreach (_get_cron_array() as $timestamp => $crons) {
foreach ($crons as $cron_name => $cron_args) {
foreach ($cron_args as $cron) {
$this->crons[$timestamp + $this->time_offset][] = array('hook' => $cron_name, 'cron' => $cron, 'hash' => acm_get_cron_hash($cron_name, $timestamp, $cron['args'], !isset($cron['interval']) ? 0 : $cron['interval']));
}
}
}
ksort($this->crons);
}
示例9: 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);
}
示例10: result
protected function result()
{
require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-modules.php';
require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-sender.php';
$sync_module = Jetpack_Sync_Modules::get_module('full-sync');
$sender = Jetpack_Sync_Sender::get_instance();
$queue = $sender->get_sync_queue();
$full_queue = $sender->get_full_sync_queue();
$cron_timestamps = array_keys(_get_cron_array());
$cron_age = microtime(true) - $cron_timestamps[0];
return array_merge($sync_module->get_status(), array('is_scheduled' => Jetpack_Sync_Actions::is_scheduled_full_sync(), 'cron_size' => count($cron_timestamps), 'oldest_cron' => $cron_age, 'queue_size' => $queue->size(), 'queue_lag' => $queue->lag(), 'queue_next_sync' => $sender->get_next_sync_time('sync') - microtime(true), 'full_queue_size' => $full_queue->size(), 'full_queue_lag' => $full_queue->lag(), 'full_queue_next_sync' => $sender->get_next_sync_time('full_sync') - microtime(true)));
}
示例11: ass_digest_schedule_print
function ass_digest_schedule_print()
{
print "<br />";
print "<br />";
// ass_digest_fire( 'dig' );
$crons = _get_cron_array();
echo "<div style='background: #fff;'>";
$sched = wp_next_scheduled('ass_digest_event');
echo "Scheduled: " . date('h:i', $sched);
$until = ((int) $sched - time()) / (60 * 60);
echo " Until: " . $until . " hours";
echo "</div>";
}
示例12: get_next_scheduled_event_timestamp
/**
* A modified version of wp_next_scheduled that doesn't takes into account
* the parameters passed to the callback.
*/
private function get_next_scheduled_event_timestamp()
{
$crons = _get_cron_array();
if (empty($crons)) {
return false;
}
foreach ($crons as $timestamp => $cron) {
if (isset($cron['awpcp-task-queue-event'])) {
return $timestamp;
}
}
return false;
}
示例13: 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);
}
示例14: spa_get_cron_data
function spa_get_cron_data()
{
$data = new stdClass();
$data->cron = _get_cron_array();
foreach ($data->cron as $time => $hooks) {
foreach ($hooks as $hook => $items) {
foreach ($items as $key => $item) {
$data->cron[$time][$hook][$key]['date'] = date_i18n(SFDATES, $time) . ' - ' . date_i18n(SFTIMES, $time);
}
}
}
$data->schedules = wp_get_schedules();
return $data;
}
示例15: getScheduledCronTasksByActionName
/**
* Finds scheduled cron tasks by the given action name.
*
* @since 3
* @return array
*/
public static function getScheduledCronTasksByActionName($sActionHookName)
{
$_aTheTasks = array();
$_aTasks = (array) _get_cron_array();
foreach ($_aTasks as $_iTimeStamp => $_aScheduledActionHooks) {
foreach ((array) $_aScheduledActionHooks as $_sScheduledActionHookName => $_aArgs) {
if (!in_array($_sScheduledActionHookName, array($sActionHookName))) {
continue;
}
$_aTheTasks[$_iTimeStamp][$_sScheduledActionHookName] = $_aArgs;
}
}
return $_aTheTasks;
}