[wp-trac] [WordPress Trac] #37703: Optimise `wp_delete_comment` as called from `wp_delete_post`

WordPress Trac noreply at wordpress.org
Thu Nov 21 18:49:37 UTC 2019


#37703: Optimise `wp_delete_comment` as called from `wp_delete_post`
-------------------------------------------------+-------------------------
 Reporter:  peterwilsoncc                        |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Comments                             |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  testing dev-feedback                           |  performance
-------------------------------------------------+-------------------------
Changes (by andraganescu):

 * keywords:  has-patch has-unit-tests 2nd-opinion needs-testing => has-
     patch has-unit-tests needs-testing dev-feedback


Comment:

 @Mte90 great work so far!

 I think it would be better if we had two different patches one for each of
 the updates proposed by @peterwilsoncc :

 1. Sort $comment_ids from highest to lowest before deleting each comment
 2. Accept array of comments when calling wp_delete_comment()

 This way it would be easier to review and test.

 Speaking of tests, the tests do delete comments, but what else should we
 expect from these changes, other than the fact that comments still get
 deleted? `wp_reparentering_comment` should be tested, and I understood
 that the main goal of the sorting was to not do reparenting anymore?

 Also it appears that we call `wp_delete_comments( $comment_ids, true )`
 twice but do the sorting only once.

 @peterwilsoncc , 1st thanks for this proposal! Just to make this clear for
 posterity: we should do these changes to speed up deleting large amounts
 of comments, correct?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/37703#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list