safety guard for publish_future_post
|Reported by:||hailin||Owned by:||anonymous|
There were reports that scheduled future post won't publish.
And once it missed the scheduled time, the Edit=>post admin page
display orange "Missed Schedule". However, there is no other trace left to determine what happened. There is no cron entry left in the options table.
I've been tracing this bug for a few weeks.
And have determined that for a missed schedule, spawn_cron() is never called in the first place. That means the cron entry wasn't in the table.
For two possible reasons:
- cron entry wasn't successfully added when user first schedule a post. Eg, network timed out, db issue. However, post_date, post_date_gmt were modified in db. So user would perceive the post has been successfully schduled, although cron entry wasn't there.
- cron entry was erased in one of the many _transition_post_status
And it wasn't added back while the post_status is 'future'
I've spent many hours trying to reproduce it without luck.
It usually happens on busy sites with thousands of daily page views.
and it happens rather randomly. Such as once per week.
So there is a need to make sure when we display "Scheduled for..",
there is indeed a cron entry there. Add it if not.
This at least fixes case 1.