Ticket #21858: miqro-21858-autosave.2.patch
File miqro-21858-autosave.2.patch, 1.6 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
1088 1088 if ( $do_autosave ) { 1089 1089 // Drafts and auto-drafts are just overwritten by autosave 1090 1090 if ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) { 1091 $id = edit_post(); 1091 1092 // Autosave shouldn't save too soon after a real save 1093 $now = time(); 1094 $then = strtotime($post->post_modified_gmt . ' +0000'); 1095 $delta = AUTOSAVE_INTERVAL / 2; 1096 1097 if ( abs($now - $then) < $delta ) 1098 $id = 0; // This tells us it didn't actually save 1099 else 1100 $id = edit_post(); // Save the post now 1101 1092 1102 } else { // Non drafts are not overwritten. The autosave is stored in a special post revision. 1093 1103 $revision_id = wp_create_post_autosave( $post->ID ); 1094 1104 if ( is_wp_error($revision_id) ) -
wp-admin/includes/post.php
158 158 wp_die( __('You are not allowed to edit this post.' )); 159 159 } 160 160 161 // Autosave shouldn't save too soon after a real save162 if ( 'autosave' == $post_data['action'] ) {163 $post = get_post( $post_ID );164 $now = time();165 $then = strtotime($post->post_date_gmt . ' +0000');166 $delta = AUTOSAVE_INTERVAL / 2;167 if ( ($now - $then) < $delta )168 return $post_ID;169 }170 171 161 $post_data = _wp_translate_postdata( true, $post_data ); 172 162 if ( is_wp_error($post_data) ) 173 163 wp_die( $post_data->get_error_message() );