Skip to content

Commit 91fbcd1

Browse files
committed
Cron fixes from masquerade. WordPress#2425
git-svn-id: https://develop.svn.wordpress.org/trunk@3635 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 457b4b5 commit 91fbcd1

3 files changed

Lines changed: 5 additions & 10 deletions

File tree

wp-admin/upgrade-functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ function upgrade_210() {
365365
$posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
366366
if ( !empty($posts) )
367367
foreach ( $posts as $post )
368-
wp_schedule_event(mysql2date('U', $post->post_date), 'once', 'publish_future_post', $post->ID);
368+
wp_schedule_single_event(mysql2date('U', $post->post_date), 'publish_future_post', $post->ID);
369369
}
370370
if ( $wp_current_db_version < 3570 ) {
371371
// Create categories for link categories if a category with the same

wp-includes/cron.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function wp_schedule_single_event($timestamp, $hook) {
66
ksort($crons);
77
update_option('cron', $crons);
88
}
9-
function wp_schedule_new_event($timestamp, $recurrence, $hook) {
9+
function wp_schedule_event($timestamp, $recurrence, $hook) {
1010
$args = array_slice(func_get_args(), 3);
1111
$crons = get_option('cron');
1212
$schedules = wp_get_schedules();
@@ -37,7 +37,7 @@ function wp_reschedule_event($timestamp, $recurrence, $hook) {
3737
while($timestamp < time() + 1) {
3838
$timestamp += $interval;
3939
}
40-
wp_schedule_new_event($timestamp, $recurrence, $hook);
40+
wp_schedule_event($timestamp, $recurrence, $hook);
4141
}
4242

4343
function wp_unschedule_event($timestamp, $hook) {
@@ -66,12 +66,6 @@ function wp_next_scheduled($hook) {
6666

6767
function spawn_cron() {
6868
if (array_shift(array_keys(get_option('cron'))) > time()) return;
69-
70-
//Since execute pings had CGI problems, but I'd like to test this without this code first
71-
// It seems to be working on CGI here, please report if you have issues
72-
/* if ( substr(php_sapi_name(), 0, 3) == 'cgi' ) {
73-
echo '<iframe src="' . $cron_url . '"></iframe>';
74-
}*/
7569

7670
$cron_url = get_settings('siteurl') . '/wp-cron.php';
7771
$parts = parse_url($cron_url);

wp-includes/default-filters.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,6 @@
8686
add_action('wp_head', 'rsd_link');
8787
add_action('publish_future_post', 'wp_publish_post', 10, 1);
8888
add_action('wp_head', 'noindex', 1);
89-
add_action('init', 'wp_cron');
89+
if(!defined('DOING_CRON'))
90+
add_action('init', 'wp_cron');
9091
?>

0 commit comments

Comments
 (0)