WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#20433 closed defect (bug) (fixed)

Don't update last_updated when deleting non-published posts

Reported by: ryan Owned by: ryan
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

add_action( 'delete_post', 'wpmu_update_blogs_date' );

Instead of that, let's hook in an action that checks the post status and updates only when published posts are deleted. This will avoid lots of updates to wp_blogs when cleaning out old auto-draft posts.

Inspired by #19663. [20440] caused massive numbers of updates to wp_blogs.

Attachments (2)

20433.patch (644 bytes) - added by SergeyBiryukov 4 years ago.
20433.2.patch (1.4 KB) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (9)

#1 @ryan
4 years ago

  • Summary changed from Don't update last_updated when deleting nn-published posts to Don't update last_updated when deleting non-published posts

#2 @nacin
4 years ago

We can probably re-purpose what went in for [19129].

#3 @SergeyBiryukov
4 years ago

  • Keywords has-patch added

Just removing the action seems enough. _update_blog_date_on_post_publish() handles the rest.

#4 @azaozz
4 years ago

Perhaps also bypass it when deleting trashed posts. Form the user's point of view they are long gone and nothing has changed.

#5 @ryan
4 years ago

Just removing the action will work fine for trashed posted that are later deleted as_update_blog_date_on_post_publish() will indeed handle things. But, it won't work for forced deletions. We don't care about the auto-draft forced deletions, but are there forced deletes we should care about?

#6 @SergeyBiryukov
4 years ago

20433.2.patch introduces _update_blog_date_on_post_delete().

#7 @ryan
4 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [20461]:

Don't update a blog's last_updated time for all post deletions. Update only when published posts are deleted.

Props SergeyBiryukov
fixes #20433

Note: See TracTickets for help on using tickets.