"Trash" status for comments updates, props caesarsgrunt, see #4529

git-svn-id: https://develop.svn.wordpress.org/trunk@11741 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2009-07-24 07:23:11 +00:00
parent 72f5a9910c
commit 245d113bfc
7 changed files with 68 additions and 60 deletions

View File

@@ -1767,32 +1767,3 @@ function wp_text_diff( $left_string, $right_string, $args = null ) {
}
endif;
/**
* Destroys comments which have previously been scheduled for destruction.
* Will do the same for posts, pages, etc in the future.
*
* @access private
* @since 2.9.0
*
* @return void
*/
function _scheduled_destruction() {
$to_destroy = get_option('to_destroy');
if (!is_array($to_destroy))
return;
$deletetimestamp = time()-(60*60*24*30);
foreach ($to_destroy['comments'] as $comment_id => $timestamp) {
if ($timestamp < $deletetimestamp) {
wp_delete_comment($comment_id);
unset($to_destroy['comments'][$comment_id]);
}
}
update_option('to_destroy', $to_destroy);
}
add_action( '_scheduled_destruction', '_scheduled_destruction' );
if ( !wp_next_scheduled('_scheduled_destruction') && !defined('WP_INSTALLING') )
wp_schedule_event(time(), 'daily', '_scheduled_destruction');