Index: comment.php
===================================================================
--- comment.php	(revision 12421)
+++ comment.php	(working copy)
@@ -798,10 +798,11 @@
 }
 
 /**
- * Removes comment ID and maybe updates post comment count.
+ * Trashes the comment and maybe updates post comment count.
  *
  * The post comment count will be updated if the comment was approved and has a
- * post ID available.
+ * post ID available. The comment will be deleted if it is already in spam or trash,
+ * if trash is disabled, or if $force_delete is true.
  *
  * @since 2.0.0
  * @uses $wpdb
@@ -810,15 +811,24 @@
  * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
  *
  * @param int $comment_id Comment ID
+ * @param bool $force_delete Whether to bypass trash and force deletion
  * @return bool False if delete comment query failure, true on success.
  */
-function wp_delete_comment($comment_id) {
+function wp_delete_comment( $comment_id, $force_delete = false ) {
 	global $wpdb;
 	if (!$comment = get_comment($comment_id))
 		return false;
 
-	if (wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
-		return wp_trash_comment($comment_id);
+	if ( !$force_delete && EMPTY_TRASH_DAYS && !in_array( wp_get_comment_status($comment_id), array('trash', 'spam') ) ) {
+		do_action('trash_comment', $comment_id);
+		if ( wp_set_comment_status($comment_id, 'trash') ) {
+			add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved);
+			add_comment_meta($comment_id, '_wp_trash_meta_time', time() );
+			do_action('trashed_comment', $comment_id);
+			return true;
+		}
+		return false;
+	}
 
 	do_action('delete_comment', $comment_id);
 
@@ -850,29 +860,13 @@
  * Moves a comment to the Trash
  *
  * @since 2.9.0
- * @uses do_action() on 'trash_comment' before trashing
- * @uses do_action() on 'trashed_comment' after trashing
+ * @uses wp_delete_comment()
  *
  * @param int $comment_id Comment ID.
  * @return mixed False on failure
  */
 function wp_trash_comment($comment_id) {
-	if ( EMPTY_TRASH_DAYS == 0 )
-		return wp_delete_comment($comment_id);
-
-	if ( !$comment = get_comment($comment_id) )
-		return false;
-
-	do_action('trash_comment', $comment_id);
-
-	if ( wp_set_comment_status($comment_id, 'trash') ) {
-		add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved);
-		add_comment_meta($comment_id, '_wp_trash_meta_time', time() );
-		do_action('trashed_comment', $comment_id);
-		return true;
-	}
-
-	return false;
+	return wp_delete_comment($comment_id);
 }
 
 /**
Index: post.php
===================================================================
--- post.php	(revision 12421)
+++ post.php	(working copy)
@@ -1155,10 +1155,12 @@
 }
 
 /**
- * Removes a post, attachment, or page.
+ * Trashes a post or page or maybe deletes it.
  *
  * When the post and page goes, everything that is tied to it is deleted also.
  * This includes comments, post meta fields, and terms associated with the post.
+ * Post or page is moved to trash instead of permanently deleted unless trash is
+ * disabled, item is already in the trash, or $force_delete is true.
  *
  * @since 1.0.0
  * @uses do_action() on 'delete_post' before deletion unless post type is 'attachment'.
@@ -1175,12 +1177,21 @@
 	if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
 		return $post;
 
-	if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS > 0 )
-			return wp_trash_post($postid);
-
 	if ( $post->post_type == 'attachment' )
 		return wp_delete_attachment( $postid, $force_delete );
 
+	// Trash post if warranted.
+	if ( !$force_delete && EMPTY_TRASH_DAYS && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' ) {
+		do_action('trash_post', $post_id);
+		add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
+		add_post_meta($post_id,'_wp_trash_meta_time', time());
+		$post['post_status'] = 'trash';
+		wp_insert_post($post);
+		wp_trash_post_comments($post_id);
+		do_action('trashed_post', $post_id);
+		return $post;
+	}
+
 	do_action('delete_post', $postid);
 
 	delete_post_meta($postid,'_wp_trash_meta_status');
@@ -1262,35 +1273,13 @@
  * Moves a post or page to the Trash
  *
  * @since 2.9.0
- * @uses do_action() on 'trash_post' before trashing
- * @uses do_action() on 'trashed_post' after trashing
+ * @uses wp_delete_post()
  *
  * @param int $postid Post ID.
  * @return mixed False on failure
  */
 function wp_trash_post($post_id = 0) {
-	if ( EMPTY_TRASH_DAYS == 0 )
-		return wp_delete_post($post_id);
-
-	if ( !$post = wp_get_single_post($post_id, ARRAY_A) )
-		return $post;
-
-	if ( $post['post_status'] == 'trash' )
-		return false;
-
-	do_action('trash_post', $post_id);
-
-	add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
-	add_post_meta($post_id,'_wp_trash_meta_time', time());
-
-	$post['post_status'] = 'trash';
-	wp_insert_post($post);
-
-	wp_trash_post_comments($post_id);
-
-	do_action('trashed_post', $post_id);
-
-	return $post;
+	return wp_delete_post($post_id);
 }
 
 /**
@@ -2816,15 +2805,19 @@
 }
 
 /**
- * Delete an attachment.
+ * Move an attachment to trash or maybe delete the attachment.
  *
- * Will remove the file also, when the attachment is removed. Removes all post
+ * If trash for media is enabled, the attachment is moved to trash, unless
+ * $force_delete is true or the attachment is already in the trash.
+ *
+ * Will remove the file also, when the attachment is deleted. Deletes all post
  * meta fields, taxonomy, comments, etc associated with the attachment (except
  * the main post).
  *
  * @since 2.0.0
  * @uses $wpdb
  * @uses do_action() Calls 'delete_attachment' hook on Attachment ID.
+ * @uses MEDIA_TRASH
  *
  * @param int $postid Attachment ID.
  * @param bool $force_delete Whether to bypass trash and force deletion
@@ -2839,8 +2832,17 @@
 	if ( 'attachment' != $post->post_type )
 		return false;
 
-	if ( !$force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status )
-		return wp_trash_post( $post_id );
+	// Trash post if warranted.
+	if ( !$force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status ) {
+		do_action('trash_attachment', $post_id);
+		add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
+		add_post_meta($post_id,'_wp_trash_meta_time', time());
+		$post['post_status'] = 'trash';
+		wp_insert_post($post);
+		wp_trash_post_comments($post_id);
+		do_action('trashed_attachment', $post_id);
+		return $post;
+	}
 
 	delete_post_meta($post_id, '_wp_trash_meta_status');
 	delete_post_meta($post_id, '_wp_trash_meta_time');
