From a5e4c0a7d9d2a30869759ea672891ce8a1af4775 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 14 Feb 2006 23:48:44 +0000 Subject: [PATCH] schedule future posts with cron when upgrading. git-svn-id: https://develop.svn.wordpress.org/trunk@3534 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/upgrade-functions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index eeda1adc42..af7b305c6c 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -359,7 +359,12 @@ function upgrade_210() { if ( $wp_current_db_version < 3531 ) { // Give future posts a post_status of future. $now = gmdate('Y-m-d H:i:59'); - $posts = $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'"); + $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'"); + + $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'"); + if ( !empty($posts) ) + foreach ( $posts as $post ) + wp_schedule_event(mysql2date('U', $post->post_date), 'once', 'publish_future_post', $post->ID); } }