mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-07 09:49:04 +00:00
Move the storage of the metadata for trashed posts into the post meta table rather than storing it in an option. See #4529.
git-svn-id: https://develop.svn.wordpress.org/trunk@11878 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3346,24 +3346,29 @@ function _cleanup_header_comment($str) {
|
||||
* @return void
|
||||
*/
|
||||
function wp_scheduled_delete() {
|
||||
global $wpdb;
|
||||
|
||||
$delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
|
||||
|
||||
$posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
|
||||
|
||||
foreach ( (array) $posts_to_delete as $post ) {
|
||||
wp_delete_post($post['post_id']);
|
||||
}
|
||||
|
||||
//Trashed Comments
|
||||
//TODO Come up with a better store for the comment trash meta.
|
||||
$trash_meta = get_option('wp_trash_meta');
|
||||
if ( !is_array($trash_meta) )
|
||||
return;
|
||||
|
||||
$delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
|
||||
|
||||
foreach ( (array) $trash_meta['comments'] as $id => $meta ) {
|
||||
if ( $meta['time'] < $delete_timestamp ) {
|
||||
wp_delete_comment($id);
|
||||
unset($trash_meta['comments'][$id]);
|
||||
}
|
||||
}
|
||||
foreach ( (array) $trash_meta['posts'] as $id => $meta ) {
|
||||
if ( $meta['time'] < $delete_timestamp ) {
|
||||
wp_delete_post($id);
|
||||
unset($trash_meta['posts'][$id]);
|
||||
}
|
||||
}
|
||||
|
||||
update_option('wp_trash_meta', $trash_meta);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user