Opened 8 years ago
Last modified 14 months ago
#43598 reviewing enhancement
site-options notoption only queried and never set in not multisite wordpress installs
| Reported by: | Grzegorz.Janoszka | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Options, Meta APIs | Version: | 4.9.5 |
| Severity: | normal | Keywords: | has-patch dev-feedback |
| Cc: | Focuses: |
Description
We have notoptions mechanism that works well. WordPress core does also query $network_id:notoptions regardless of multiste. However, such option is set only in multisite installs. As a result, if you are not running multisite, you are only querying for $network_id:notoptions and you never set it. It beats the idea of notoptions - we read it, but we never set it - what's the point?
Possible solutions:
- read $network_id:notoptions only in multisite installs
- set $network_id:notoptions also in not multisite installs
Attachments (1)
Change History (9)
#5
@
7 years ago
- Milestone 5.2 → 5.3
This ticket has not received any attention during the 5.2 cycle. With beta 1 tomorrow, going to punt this to 5.3.
#6
@
7 years ago
@SergeyBiryukov Can you review this one and decide whether it's ready for version 5.3 Beta 1, due out tomorrow? If not, we can punt this to a future milestone.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hey, welcome back @Grzegorz.Janoszka!
Thank you for your ticket!
get_network_optionis an alias forget_site_option, which is called in core in many places. In non-multisite installs,$network_idis set to 1 by default.These calls are absolutely valid, and
$network_id:notoptionsis indeed not being set. There's ais_multisite()condition which prevents the$network_id:notoptionslogic, directs the call to plain oldget_optionswhich stores non-existing options in the plain oldnotoptionscache.In single-site setups the multisite code bits are never called apart from
wp_cache_getwhich is deterministic there. It seems safe to omit thewp_cache_getcall 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 :)