Customize: Extend auto-draft life of a `customize_changeset` post whenever modified.

Keep bumping the date for the auto-draft to preserve it from garbage-collection via `wp_delete_auto_drafts()` after 7 days.

See #30937.
Fixes #39713.

Built from https://develop.svn.wordpress.org/trunk@40041


git-svn-id: http://core.svn.wordpress.org/trunk@39978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-02-05 06:39:41 +00:00
parent 717aeab3cc
commit 85b4cddebf
2 changed files with 9 additions and 1 deletions

View File

@ -2494,6 +2494,14 @@ final class WP_Customize_Manager {
} elseif ( $args['date_gmt'] ) {
$post_array['post_date_gmt'] = $args['date_gmt'];
$post_array['post_date'] = get_date_from_gmt( $args['date_gmt'] );
} elseif ( $changeset_post_id && 'auto-draft' === get_post_status( $changeset_post_id ) ) {
/*
* Keep bumping the date for the auto-draft whenever it is modified;
* this extends its life, preserving it from garbage-collection via
* wp_delete_auto_drafts().
*/
$post_array['post_date'] = current_time( 'mysql' );
$post_array['post_date_gmt'] = '';
}
$this->store_changeset_revision = $allow_revision;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40040';
$wp_version = '4.8-alpha-40041';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.