[wp-trac] [WordPress Trac] #30858: Scheduled cron job with custom interval is unset on next cron event
WordPress Trac
noreply at wordpress.org
Mon Dec 29 11:20:39 UTC 2014
#30858: Scheduled cron job with custom interval is unset on next cron event
----------------------------+-----------------------------
Reporter: mrtphoto | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cron API | Version: 4.1
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
plugin adds new interval
{{{
function execution_schedule( $schedules ) {
// adds 2min schedule interval for all import execution script
$schedules['twomin'] = array(
'interval' => 120,
'display' => __('Two Minutes')
);
return $schedules;
}
add_filter( 'cron_schedules', 'execution_schedule' );
}
}}}
on save options for plugin cron url, we clear the old hook and set the new
cron job with custom interval
{{{
wp_clear_scheduled_hook( 'syt_trigger_one' );
wp_clear_scheduled_hook( 'syt_execution_one' );
wp_schedule_event(current_time( 'timestamp'
),'twicedaily','syt_trigger_one');
wp_schedule_event(current_time( 'timestamp'
),'twomin','syt_execution_one');
}}}
on options page I display the schedule for the hook
{{{
echo wp_get_schedule( 'syt_execution_one' );
}}}
Immediately after saving it displays 'twomin'. When loading the options
page after that it shows nothing ''.
An output of
{{{
print_r(get_option('cron'));
}}}
confirms the existence of the scheduled cron event on save and subsequent
disappearance of the hook from cron
{{{
[1419832800] => Array
(
[syt_trigger_one] => Array
(
[40cd750bba9870f18aada2478b24840a] => Array
(
[schedule] => twicedaily
[args] => Array
(
)
[interval] => 43200
)
)
[syt_execution_one] => Array
(
[40cd750bba9870f18aada2478b24840a] => Array
(
[schedule] => twomin
[args] => Array
(
)
[interval] => 120
)
)
)
}}}
..after loading the options page again, no "syt_execution_one" hook:
{{{
[1419832800] => Array
(
[syt_trigger_one] => Array
(
[40cd750bba9870f18aada2478b24840a] => Array
(
[schedule] => twicedaily
[args] => Array
(
)
[interval] => 43200
)
)
)
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30858>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list