[wp-trac] [WordPress Trac] #31985: WP_Network class

WordPress Trac noreply at wordpress.org
Wed Jun 3 09:02:39 UTC 2015


#31985: WP_Network class
--------------------------------+------------------------
 Reporter:  johnjamesjacoby     |       Owner:
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  4.3
Component:  Networks and Sites  |     Version:  3.0
 Severity:  normal              |  Resolution:
 Keywords:  dev-feedback        |     Focuses:  multisite
--------------------------------+------------------------

Comment (by spacedmonkey):

 Been looking at this work and looks great. Have some feedback, so here we
 go.

 Been looking at this I feel like this class should be little more
 filterable. I know it might be something you want to worry about at the
 end, I thought I would bring it up now.

 Firstly here

 {{{
  public function __construct( $network = false ) {
         // Bail if not populating from an existing network
         if ( empty( $network ) ) {
                  return;
         }
 }}}

 How about

 {{{
  public function __construct( $network = false ) {
         $network = apply_filters( 'pre_get_network', $network );
         // Bail if not populating from an existing network
         if ( empty( $network ) ) {
                  return $network;
         }
 }}}

 Just in case you want to highjack the getting network process for
 anything. Also returned the network variable, do you can do some type
 checking on the return. Empty will flag, null, zero and empty string
 values, maybe want to return that...

 Get get_core_option_keys should return through apply_filters.

 Add / edit / delete should clear / set cache values, as you don't to
 return an old version of the network object with incorrect data.

 {{{
 $network = wp_cache_get( $network_id, 'networks' )
 }}}

 get_core_options method should use get_site_option instead of raw sql
 query. I know this means more sql queries, but at the moment, it is
 bypassing all the filters on get_site_option, which many use to change
 these values out of the db. This would also mean that set_site_name also
 magically gets filterable.

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


More information about the wp-trac mailing list