Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#55227 closed enhancement (fixed)

Attachments: add caching to wp_count_attachments

Reported by: jeherve's profile jeherve Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch dev-feedback needs-testing has-unit-tests needs-dev-note
Focuses: performance Cc:

Description

I noticed that while wp_count_posts includes some caching, {{{wp_count_attachments}} does not. Would it make sense to add the same caching system there?

Attachments (1)

55227.diff (2.1 KB) - added by jeherve 3 years ago.
Add caching to wp_count_attachments

Download all attachments as: .zip

Change History (15)

@jeherve
3 years ago

Add caching to wp_count_attachments

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


2 years ago

#2 @antpb
2 years ago

  • Milestone changed from Awaiting Review to 6.1

This came up in the last media meeting and was thought to be a good candidate for 6.1

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


2 years ago

This ticket was mentioned in PR #3093 on WordPress/wordpress-develop by mukeshpanchal27.


2 years ago
#4

The PR refresh the patch ageist the trunk and remove function _count_attachments_cache_key function as it was called only one time in wp_count_attachments().

Trac ticket: https://core.trac.wordpress.org/ticket/55227

#5 @mukesh27
2 years ago

  • Keywords dev-feedback needs-testing added
  • Owner set to joedolson
  • Status changed from new to assigned

Hi there!

As we are nearing the release cycle of 6.1.0 let's wrap this ticket so it will merge into the core for this version. I don't find any blocker for this. @jeherve feel free to test the PR and share your feedback.

Assign to @joedolson as per last meeting. Is this ticket on your radar?

This ticket was mentioned in Slack in #core-media by mukeshpanchal27. View the logs.


2 years ago

mukeshpanchal27 commented on PR #3093:


2 years ago
#7

Thank you for the feedback, @costdev I have updated the code with a single apply_filters( 'wp_count_attachments' ).

Ping @antpb Media component maintainer for the review.

#8 @mukesh27
2 years ago

  • Keywords has-unit-tests added

Hi, Added unit test for the wp_count_attachments cache

#9 @robinwpdeveloper
2 years ago

PR #3093 looks good to me.
Thanks @mukesh27

#10 @audrasjb
2 years ago

  • Owner changed from joedolson to audrasjb
  • Status changed from assigned to reviewing

Re-assigning for final review.

#11 @audrasjb
2 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 54255:

Media: Add caching to wp_count_attachments().

This changeset adds caching to wp_count_attachments(), for better consistency with wp_count_posts().

Props jeherve, antpb, mukesh27, robinwpdeveloper, costdev.
Fixes #55227.

#13 @milana_cap
2 years ago

  • Keywords add-to-field-guide needs-dev-note added

This can either go into shared Dev note of just Field guide.

#14 @milana_cap
2 years ago

  • Keywords add-to-field-guide removed
Note: See TracTickets for help on using tickets.