Move the storage of the metadata for trashed comments into the comment meta table rather than storing it in an option. See #4529.

git-svn-id: https://develop.svn.wordpress.org/trunk@11945 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood
2009-09-17 20:51:12 +00:00
parent 5fa5b6d05b
commit 8f93bd78f8
3 changed files with 16 additions and 37 deletions

View File

@@ -3380,19 +3380,10 @@ function wp_scheduled_delete() {
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;
foreach ( (array) $trash_meta['comments'] as $id => $meta ) {
if ( $meta['time'] < $delete_timestamp ) {
wp_delete_comment($id);
unset($trash_meta['comments'][$id]);
}
$comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
foreach ( (array) $comments_to_delete as $comment ) {
wp_delete_comment($comment['comment_id']);
}
update_option('wp_trash_meta', $trash_meta);
}
?>