[wp-trac] [WordPress Trac] #14461: Consolidate `current_site_name` cache-key to `site_name`

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 30 01:11:02 UTC 2010

#14461: Consolidate `current_site_name` cache-key to `site_name`
 Reporter:  benward       |       Owner:  benward                                                   
     Type:  defect (bug)  |      Status:  new                                                       
 Priority:  normal        |   Milestone:  Awaiting Review                                           
Component:  Multisite     |     Version:  3.0                                                       
 Severity:  normal        |    Keywords:  caching, multi-site, options, site_name, current_site_name
 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.

Ticket URL: <http://core.trac.wordpress.org/ticket/14461>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list