[wp-trac] Re: [WordPress Trac] #4710: A small patch to fix future posting

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 8 04:03:28 GMT 2007


#4710: A small patch to fix future posting
----------------------------+-----------------------------------------------
 Reporter:  donncha         |        Owner:  markjaquith
     Type:  defect          |       Status:  assigned   
 Priority:  high            |    Milestone:  2.3 (trunk)
Component:  Administration  |      Version:  2.3        
 Severity:  critical        |   Resolution:             
 Keywords:  futureposting   |  
----------------------------+-----------------------------------------------
Changes (by markjaquith):

  * status:  new => assigned
  * priority:  normal => high
  * version:  => 2.3
  * milestone:  => 2.3 (trunk)
  * owner:  anonymous => markjaquith
  * severity:  normal => critical

Old description:

> Barry figured out that the cron entry the scheduler created was simply
> appended to the blog cron option. He suggested clearing the schedule
> before making a new one.
> I verified this, and attached is a small patch that calls
> wp_clear_scheduled_hook() before creating the new schedule entry.
>
> I tried adding wp_clear_scheduled_hook( $hook, $args ) to
> wp_schedule_single_event() but it didn't work. When $args is an array it
> doesn't seem to work.
> You'll see from the patch I pass $post->ID directly as an int to the
> clear function. I'm not sure why that didn't work as an array.

New description:

 Barry figured out that the cron entry the scheduler created was simply
 appended to the blog cron option. He suggested clearing the schedule
 before making a new one.
 I verified this, and attached is a small patch that calls
 wp_clear_scheduled_hook() before creating the new schedule entry.

 I tried adding wp_clear_scheduled_hook( $hook, $args ) to
 wp_schedule_single_event() but it didn't work. When $args is an array it
 doesn't seem to work.
 You'll see from the patch I pass $post->ID directly as an int to the clear
 function. I'm not sure why that didn't work as an array.


 ----

 Barry's description:

 How to replicate:

 1) Publish a post with a date in the future

 2) Edit that post and change the timestamp to a date further in the future
 and save the post

 If you check the database, you will see that the timestamps have been
 updated correctly in the posts table, but in the options table, the cron
 option contains 2 objects in the array -- one with the old timestamp and
 one with the new one. When wp-cron runs, it checks that option and sees
 the older timestamp and therefore publishes the post at the incorrect
 time.

 What should happen:

 When the timestamp of a future post is changed, the entry in the cron
 option should be replaced, not appended to.

 ----

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4710#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list