WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/12/2012 06:49:48 PM (9 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r20435 r20453  
    51655165
    51665166/**
     5167 * Deletes auto-drafts for new posts that are > 7 days old
     5168 *
     5169 * @since 3.4.0
     5170 */
     5171function wp_delete_auto_drafts() {
     5172    global $wpdb;
     5173
     5174    // Cleanup old auto-drafts more than 7 days old
     5175    $old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
     5176    foreach ( (array) $old_posts as $delete )
     5177        wp_delete_post( $delete, true ); // Force delete
     5178}
     5179
     5180/**
    51675181 * Filters the request to allow for the format prefix.
    51685182 *
Note: See TracChangeset for help on using the changeset viewer.