Autosave causes problems if it never receives a response
|Reported by:||mdawaffe||Owned by:||anonymous|
Since autosave disables the submit buttons, you can't save your data if it never gets a response from the server.
The button disabling was done to prevent collisions (multiple posts being created with same data), so we need a new way of preventing collisions.
- Re-enables buttons 1 second after disabling them.
- Keeps a record of the last 24 hours worth of post_IDs (and what temporary negative number from which they initially came).
- If you try to (auto)save a post with a negative post_ID, it first checks that record to see if that post has already been (auto)saved. If so, save that post under the real id.
- Autosave will silently forgo writing to the DB if the post was saved less than autosave_interval / 2 = 120 / 2 = 60 seconds ago.
This is accomplished by:
- new option: autosave_draft_ids
- a hack each in wp_write_post() and edit_post() (the functions defined in admin-functions.php).
Collisions are still *possible*, but much less likely.