[wp-trac] [WordPress Trac] #39715: Customize: Keep alive auto-drafts created for page/post stubs, and delete when changeset is garbage-collected
WordPress Trac
noreply at wordpress.org
Fri Apr 14 17:30:10 UTC 2017
#39715: Customize: Keep alive auto-drafts created for page/post stubs, and delete
when changeset is garbage-collected
--------------------------+-----------------------
Reporter: westonruter | Owner:
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 4.7.5
Component: Customize | Version: 4.7
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+-----------------------
Comment (by westonruter):
@utkarshpatel thinking about this some more. So the problem is to make
sure that the reference count for a given auto-draft page/post stub in a
given changeset is 1. If a changeset has been duplicated, then the
reference count would be greater than 1 and the auto-draft stubs should
not be garbage-collected until the reference count reduces to 1 again.
Essentially we'd have to query the `post_content` for all changesets
(other than the one being deleted), parse out the
`nav_menus_created_posts` from each one, merge the post IDs into a list.
Then, for delete each post in `nav_menus_created_posts` for ''if'' it does
not exist in the set of all `nav_menus_created_posts` gathered from all
other changesets. Right?
Since currently changeset duplication is only in plugin territory
(Customize Snapshots), perhaps accounting for deletion of a page/post
stubs should be handled in plugin territory as well? Ultimately, changing
the status of a changeset to `draft` is currently plugin territory so
maybe actually the whole logic for garbage-collection should be deferred
for a plugin to manage. Core could just be solely concerned with extending
the life of the auto-draft stubs to prevent premature deletion, but for
now leave the second part up to the plugin that transitioned the changeset
to a draft status in the first place.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39715#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list