mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -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);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user