Make WordPress Core

Changeset 3534


Ignore:
Timestamp:
02/14/2006 11:48:44 PM (19 years ago)
Author:
ryan
Message:

schedule future posts with cron when upgrading.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upgrade-functions.php

    r3533 r3534  
    360360        // Give future posts a post_status of future.
    361361        $now = gmdate('Y-m-d H:i:59');
    362         $posts = $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");
     362        $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");
     363       
     364        $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
     365        if ( !empty($posts) )
     366            foreach ( $posts as $post )
     367                wp_schedule_event(mysql2date('U', $post->post_date), 'once', 'publish_future_post', $post->ID);
    363368    }
    364369}
Note: See TracChangeset for help on using the changeset viewer.