WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#14461 closed defect (bug) (fixed)

Consolidate `current_site_name` cache-key to `site_name`

Reported by: benward Owned by: benward
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

Currently—with object caching enabled (APC, in this case)—changing the name of the network in Super Admin: Options does not stick; the old name persists until the cache is cleared.

This is because the network named is retrieved from ms-load.php:get_current_site_name(), which pulls the network name from a ':current_site_name' cache key. However, the options (and all other instances) only save/invalidate the ':site_name' cache key. When you save Site Options, ':site_name' is updated and ':current_site_name' is not.

':current_site_name' is only used by the get_current_site_name() function. If ':current_site_name' is not set, the function pulls ':site_name' as the first fallback (also from the cache.) ':current_site_name' is therefore redundant, and maintains old data in the cache when options are saved.

This patch simply removes the ':current_site_name' cache lookup from get_current_site_name(), goes straight to ':site_name' instead, and in the event that it has to look-up from the database, caches ':site_name'.

Site Name appears to be the only affected field.

Attachments (1)

fix-remove-current-site-name-duplicache.diff (1.4 KB) - added by benward 10 years ago.
Patch to remove get/set of ':current_site_name' cache key and just use ':site_name' instead.

Download all attachments as: .zip

Change History (4)

@benward
10 years ago

Patch to remove get/set of ':current_site_name' cache key and just use ':site_name' instead.

#1 @benward
10 years ago

  • Keywords has-patch added; caching multi-site options site_name current_site_name removed

#2 @nacin
10 years ago

  • Milestone changed from Awaiting Review to 3.1

#3 @ryan
10 years ago

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

(In [15551]) Cache to site_name instead of current_site_name. Props benward. fixes #14461

Note: See TracTickets for help on using tickets.