Opened 8 years ago
Last modified 7 months ago
#43598 reviewing enhancement
site-options notoption only queried and never set in not multisite wordpress installs
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | 4.9.5 |
| Component: | Options, Meta APIs | Keywords: | has-patch dev-feedback |
| Focuses: | Cc: |
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)
#2
@
8 years ago
- Milestone changed from Awaiting Review to 5.0
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
#5
@
7 years ago
- Milestone changed from 5.2 to 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
@
6 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.
Note: See
TracTickets for help on using
tickets.
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 :)