Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#55227 closed enhancement (fixed)

Attachments: add caching to wp_count_attachments

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

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 4 years ago.
Add caching to wp_count_attachments

Download all attachments as: .zip

Change History (15)

@jeherve
4 years ago

Add caching to wp_count_attachments

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


4 years ago

#2 @antpb
4 years ago

  • Milestone Awaiting Review6.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.


4 years ago

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


4 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
4 years ago

  • Keywords dev-feedback needs-testing added
  • Owner set to joedolson
  • Status newassigned

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.


4 years ago

mukeshpanchal27 commented on PR #3093:


4 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
4 years ago

  • Keywords has-unit-tests added

Hi, Added unit test for the wp_count_attachments cache

#9 @robinwpdeveloper
4 years ago

PR #3093 looks good to me.
Thanks @mukesh27

#10 @audrasjb
4 years ago

  • Owner changed from joedolson to audrasjb
  • Status assignedreviewing

Re-assigning for final review.

#11 @audrasjb
4 years ago

  • Resolutionfixed
  • Status reviewingclosed

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
4 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
4 years ago

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