Make WordPress Core

Opened 17 months ago

Closed 15 months ago

Last modified 15 months ago

#58175 closed defect (bug) (fixed)

Remove unused 'usermeta' global cache group

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.3 Priority: normal
Severity: normal Version:
Component: Cache API Keywords: good-first-bug has-patch has-unit-tests needs-testing needs-testing-info commit
Focuses: Cc:

Description

The usermeta cache group was introduced in [3011], but was never actually used in core.

The user_meta group is used instead, see [15482], [16562], and [54940].

To avoid confusion, I think the former should be removed from wp_cache_add_global_groups() calls in:

  • wp-includes/load.php
  • wp-includes/ms-blogs.php
  • tests/phpunit/includes/abstract-testcase.php

See [40347] / #38725 for a precedent of removing another unused cache group.

Change History (7)

This ticket was mentioned in PR #4366 on WordPress/wordpress-develop by @ignatggeorgiev.


17 months ago
#1

  • Keywords has-patch has-unit-tests added; needs-patch removed

Removing unused 'usermeta' global cache group, as it was never acutally used in core, instead the 'user_meta' group is used instead.

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

#2 @ignatggeorgiev
17 months ago

Added the patch above, should be taking care of the issue.

#3 @oglekler
16 months ago

  • Keywords needs-testing needs-testing-info added

I am adding needs-testing and needs-testing-info because from my point of view, proper testing looks a bit tricky for the good-first-bug.

#4 @spacedmonkey
15 months ago

  • Keywords commit added

#5 @peterwilsoncc
15 months ago

Test Report

Testing the absence of something is quite challenging, so I validated the following:

  • usermeta is not used by WP Core Object Cache
  • user_meta is used by WP Core's Object Cache

Method

  1. Add xdebug conditional break points to wp_cache_add(), wp_cache_add_multiple(), wp_cache_replace() and wp_cache_set()
  2. For test run one, the condition is $group === 'usermeta'
  3. For test run two, the condition is $group === 'user_meta'

For each test, I clicked on all admin pages, and the following front-end pages:

  • home
  • singular post
  • author
  • term archive

Environment

  • OS: macOS 12.6.6
  • Web Server: nginx/1.18.0
  • PHP: 7.4.33
  • WordPress: 6.3-alpha-55505-src
  • Browser: Firefox 114
  • Theme: Twenty Twenty-Two
  • Active Plugins: none

Actual Results

  • ✅ No breakpoints hit for the usermeta condition
  • ✅ All pages hit breakpoints for the user_meta condition

I agree with Jonny above, this is ready for commit.

#6 @SergeyBiryukov
15 months ago

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

In 55940:

Cache API: Remove unused usermeta global cache group.

The usermeta group was introduced in WP 2.0, but was never actually used in WordPress core.

The user_meta group is used instead.

Follow-up to [3011], [15482], [16562], [53823], [53832], [54940].

Props ignatggeorgiev, peterwilsoncc, oglekler, pamprn09, spacedmonkey, SergeyBiryukov.
Fixes #58175.

@SergeyBiryukov commented on PR #4366:


15 months ago
#7

Thanks for the PR! Merged in r55940.

Note: See TracTickets for help on using tickets.