[wp-trac] [WordPress Trac] #43598: site-options notoption only queried and never set in not multisite wordpress installs
WordPress Trac
noreply at wordpress.org
Sun Mar 25 20:05:23 UTC 2018
#43598: site-options notoption only queried and never set in not multisite
wordpress installs
------------------------------------+------------------------------
Reporter: Grzegorz.Janoszka | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: 4.9.5
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses:
------------------------------------+------------------------------
Changes (by soulseekah):
* keywords: => has-patch dev-feedback
Comment:
Hey, welcome back @Grzegorz.Janoszka!
Thank you for your ticket!
`get_network_option` is an alias for `get_site_option`, which is called in
core in many places. In non-multisite installs, `$network_id` is set to 1
by default.
These calls are absolutely valid, and `$network_id:notoptions` is indeed
not being set. There's a `is_multisite()` condition which prevents the
`$network_id:notoptions` logic, directs the call to plain old
`get_options` which stores non-existing options in the plain old
`notoptions` cache.
In single-site setups the multisite code bits are never called apart from
`wp_cache_get` which is deterministic there. It seems safe to omit the
`wp_cache_get` call since it's never being set to anything useful but
called multiple times from core. It does set wp_cache_set(
$notoptions_key, $notoptions, 'site-options' ); to an empty array in
single-site installs, which is also useless, since it will always remain
as such.
43599.diff stubs these calls out. Might need unit-tests to make sure that
notoptions caching works in multisite mode as it is supposed to, and that
it's always empty in single-sites. Or we can risk it :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43598#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list