[wp-trac] [WordPress Trac] #27734: 3.8.2 Regression: quick post on dashboard no-longer functioning
WordPress Trac
noreply at wordpress.org
Fri Apr 11 05:41:50 UTC 2014
#27734: 3.8.2 Regression: quick post on dashboard no-longer functioning
-------------------------------+-----------------------------
Reporter: kirrus | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.8.3
Component: Posts, Post Types | Version: 3.8.2
Severity: normal | Resolution:
Keywords: has-patch | Focuses: administration
-------------------------------+-----------------------------
Comment (by nacin):
[attachment:27734.2.diff] attempts to rescue lost auto drafts.
[attachment:27734.3.diff] takes it further by making sure we also try to
rescue title-only Quick Drafts (those submitted without content). I
recognize both patches incorrectly refer to 3.8.2, not 3.8.3.
This patch can't do a raw query against usermeta for
dashboard_quick_press_last_post_id as these are per-site options, so
they'd be keyed by the DB prefix. Thus we need to look into the posts
table for items that fit our criteria. It ends up being pretty simple:
post_type of 'post', post_status of 'auto-draft', post_date after
3.7.2/3.8.2 shipped. This query uses the type_status_date index so it's
fast. auto-drafts are garbage collected every 7 days so there isn't much
for it to find.
It then goes through each auto-draft. If it has content, it knows it needs
to be promoted. If it only has a title, then we need to check that it is
not 'Auto Draft' (as in, a regular auto draft either in use or waiting to
be GC'd). A note, it's not feasible for an auto-draft to have neither a
title nor content, as then wp_insert_post() will reject it as being empty.
Why am I saying "try" or "attempt" to rescue? Unfortunately, each save of
Quick Draft by the same user would update the existing auto draft they
previously lost. If they used Quick Draft in succession, or tried again
when they couldn't find their post — both of which are not unlikely — we
can only rescue their last edit. This is because Quick Draft holds onto a
single auto-draft post ID per user and will re-use it as long as it
remains an auto draft. (This was for performance — it prevents new auto
drafts from being created every time the dashboard was visited.)
Ironically, when Quick Press became Quick Draft in 3.8 and was greatly
simplified, we no longer had a need for auto drafts as we were no longer
supporting media. We should have dropped this convoluted logic entirely
and that's something we can now do in 4.0.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27734#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list