[wp-trac] [WordPress Trac] #61730: `delete_network_option` sets network `notoptions` cache on non-multisites, but `add_network_option` and `update_network_option` do not clear it

WordPress Trac noreply at wordpress.org
Tue Jul 23 14:18:30 UTC 2024


#61730: `delete_network_option` sets network `notoptions` cache on non-multisites,
but `add_network_option` and `update_network_option` do not clear it
--------------------------------+-----------------------------
 Reporter:  bjorsch             |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:  trunk
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 On a non-multisite, `get_network_option()`, `add_network_option()`, and
 `update_network_option()` don't bother updating the network `notoptions`
 cache, instead reling on `get_option()`, `add_option()`, and
 `update_option()` to use the non-network `notoptions`.

 r58782 had `delete_network_option()` start updating the network
 `notoptions` cache even on non-multisites, which breaks the other
 functions since they do check this otherwise-unused-on-non-multisites
 cache.

 Testing using `wp shell`:

 {{{
 wp> add_network_option( 1, 'some-option', 'xyz' );
 => bool(true)
 wp> delete_network_option( 1, 'some-option' );
 => bool(true)
 wp> wp_cache_get( '1:notoptions', 'site-options' );
 => array(1) {
   ["some-option"]=>
   bool(true)
 }
 wp> add_network_option( 1, 'some-option', 'abc' );
 => bool(true)
 wp> wp_cache_get( '1:notoptions', 'site-options' );
 => array(1) {
   ["some-option"]=>
   bool(true)
 }
 wp> get_network_option( 1, 'some-option' );
 => bool(false)
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61730>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list