Changeset 40099 for branches/4.7
- Timestamp:
- 02/21/2017 07:02:14 AM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
-
branches/4.7/src/wp-includes/class-wp-customize-manager.php
r40098 r40099 2495 2495 $post_array['post_date_gmt'] = $args['date_gmt']; 2496 2496 $post_array['post_date'] = get_date_from_gmt( $args['date_gmt'] ); 2497 } elseif ( $changeset_post_id && 'auto-draft' === get_post_status( $changeset_post_id ) ) { 2498 /* 2499 * Keep bumping the date for the auto-draft whenever it is modified; 2500 * this extends its life, preserving it from garbage-collection via 2501 * wp_delete_auto_drafts(). 2502 */ 2503 $post_array['post_date'] = current_time( 'mysql' ); 2504 $post_array['post_date_gmt'] = ''; 2497 2505 } 2498 2506 -
branches/4.7/tests/phpunit/tests/customize/manager.php
r40098 r40099 1106 1106 1107 1107 /** 1108 * Test that updating an auto-draft changeset bumps its post_date to keep it from getting garbage collected by wp_delete_auto_drafts(). 1109 * 1110 * @ticket 31089 1111 * @see wp_delete_auto_drafts() 1112 * @covers WP_Customize_Manager::save_changeset_post() 1113 */ 1114 function test_save_changeset_post_dumping_auto_draft_date() { 1115 global $wp_customize; 1116 wp_set_current_user( self::$admin_user_id ); 1117 1118 $uuid = wp_generate_uuid4(); 1119 $changeset_post_id = wp_insert_post( array( 1120 'post_type' => 'customize_changeset', 1121 'post_content' => '{}', 1122 'post_name' => $uuid, 1123 'post_status' => 'auto-draft', 1124 'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '-3 days' ) ), 1125 ) ); 1126 1127 $post = get_post( $changeset_post_id ); 1128 $original_post_date = $post->post_date; 1129 1130 $wp_customize = $this->create_test_manager( $uuid ); 1131 $wp_customize->save_changeset_post( array( 1132 'status' => 'auto-draft', 1133 'data' => array( 1134 'blogname' => array( 1135 'value' => 'Admin 1 Title', 1136 ), 1137 ), 1138 ) ); 1139 1140 $post = get_post( $changeset_post_id ); 1141 $this->assertNotEquals( $post->post_date, $original_post_date ); 1142 } 1143 1144 /** 1108 1145 * Test writing changesets when user supplies unchanged values. 1109 1146 *
Note: See TracChangeset
for help on using the changeset viewer.