[wp-trac] [WordPress Trac] #20021: wp_load_alloptions() does not cache result when MultiSite is enabled

WordPress Trac noreply at wordpress.org
Fri Mar 7 15:01:43 UTC 2014


#20021: wp_load_alloptions() does not cache result when MultiSite is enabled
------------------------------------+----------------------
 Reporter:  gcorne                  |       Owner:
     Type:  defect (bug)            |      Status:  closed
 Priority:  normal                  |   Milestone:
Component:  Cache API               |     Version:  3.3.1
 Severity:  normal                  |  Resolution:  invalid
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+----------------------

Comment (by TocydLive):

 Replying to [comment:3 gcorne]:
 > Sorry for the noise.


 Hi Gregory,

 From my point of view, this post is not noise, because your patch seem's
 to correct one incorrect behavior on my subfolder multisite
 installation...

 Briefly, when I try to use get_blog_option, a call is made to
 wp_load_alloptions and always return the site options instead of the blog
 option value...

 You're post is pointing out that this criteria (see below) is use to
 determine if the cache is needed to be loaded again or not... And as it
 was suppose to, on my installation WP_INSTALLING is not set and
 is_multisite() return true so it's resulting in a cache check

 {{{
 if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
      // check cache
 else
      // don't touch the cache
 }}}

 The problem is that the cache is used to return options value but this
 return the site cache options and not the blog cache options as they have
 not been loaded yet...If I force the site to refresh the cache by defining
 WP_INSTALLING, the correct value are returned... When I unset the
 WP_INSTALLING, the buging behavior come back...

 Meanwhile, If I use your patch, the wp_load_alloptions work like as I
 expect and the get_blog_option finally return the correct blog option
 value...

 Here is my two questions:

 1- Did you know another cause that can explain the wp_load_alloptions
 behavior to not working properly on a multisite(sub-folder) configuration
 .... (Not loading properly blog options in cache)
 2- As your patch work for me, does it is correct to use it ?


 Thank's for sharing your expertise!

 Simon

--
Ticket URL: <https://core.trac.wordpress.org/ticket/20021#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list