[wp-trac] [WordPress Trac] #28290: Changing _site_option functions for _network_option functions

WordPress Trac noreply at wordpress.org
Thu Sep 17 20:46:41 UTC 2015


#28290: Changing _site_option functions for _network_option functions
--------------------------------+---------------------------
 Reporter:  jmlapam             |       Owner:  spacedmonkey
     Type:  enhancement         |      Status:  assigned
 Priority:  normal              |   Milestone:  4.4
Component:  Networks and Sites  |     Version:  4.0
 Severity:  normal              |  Resolution:
 Keywords:  needs-patch         |     Focuses:  multisite
--------------------------------+---------------------------

Comment (by spacedmonkey):

 Here is my first pass at the functions. Things to point out.

 - I haven't done any testing on it yet. Either functional or unit.
 - I have changed all references to *_site_option, throughout the core,
 which explains the large files size / name of files changed.
 - I have to deprecated use_cache flag in get_site_options.
 - I have added new filters / action with the networking naming and the
 network id passed to them. Old filters are still in place.
 - All these functions allow for 0 to be sent as param, as this is a valid
 arg. 0 values are used to stored truly global network options.

 The only bit I am not really happy with is the following lines.

 {{{
         /** If network ID not set, get current network. **/
         if( false === $network_id && is_multisite() ){
                 $current_network = get_current_site();
                 $network_id = $current_network->id;
         }
         /** Make sure network id is an int */
         $network_id = (int) $network_id;
 }}}

 We need something that will detect if the network is false, but allow 0 to
 be passed.

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


More information about the wp-trac mailing list