Schedule auto-draft deletion from post-new.php instead of from admin.php. This provides better throttling for large multisite installs and reduces the risk of a delete avalanche.

fixes #19663


git-svn-id: https://develop.svn.wordpress.org/trunk@20453 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2012-04-12 18:49:48 +00:00
parent c08d986825
commit d1100bacb4
4 changed files with 19 additions and 6 deletions

View File

@@ -3308,7 +3308,6 @@ function _cleanup_header_comment($str) {
/**
* Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
* Deletes auto-drafts for new posts that are > 7 days old
*
* @since 2.9.0
*/
@@ -3350,11 +3349,6 @@ function wp_scheduled_delete() {
wp_delete_comment($comment_id);
}
}
// Cleanup old auto-drafts more than 7 days old
$old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
foreach ( (array) $old_posts as $delete )
wp_delete_post( $delete, true ); // Force delete
}
/**