Make WordPress Core


Ignore:
Timestamp:
09/17/2009 08:51:12 PM (17 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

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

    r11930 r11945  
    33813381        }
    33823382
    3383         //Trashed Comments
    3384         //TODO Come up with a better store for the comment trash meta.
    3385         $trash_meta = get_option('wp_trash_meta');
    3386         if ( !is_array($trash_meta) )
    3387                 return;
    3388 
    3389         foreach ( (array) $trash_meta['comments'] as $id => $meta ) {
    3390                 if ( $meta['time'] < $delete_timestamp ) {
    3391                         wp_delete_comment($id);
    3392                         unset($trash_meta['comments'][$id]);
    3393                 }
    3394         }
    3395 
    3396         update_option('wp_trash_meta', $trash_meta);
     3383        $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);
     3384       
     3385        foreach ( (array) $comments_to_delete as $comment ) {
     3386                wp_delete_comment($comment['comment_id']);
     3387        }
    33973388}
    33983389?>
Note: See TracChangeset for help on using the changeset viewer.