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

WordPress Trac noreply at wordpress.org
Thu Sep 10 22:42:36 UTC 2015


#31985: WP_Network class
------------------------------------+-------------------------
 Reporter:  johnjamesjacoby         |       Owner:  jeremyfelt
     Type:  task (blessed)          |      Status:  accepted
 Priority:  normal                  |   Milestone:  4.4
Component:  Networks and Sites      |     Version:  3.0
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:  multisite
------------------------------------+-------------------------

Comment (by jeremyfelt):

 Thanks for the patch @spacedmonkey!

 Replying to [comment:35 spacedmonkey]:
 > - Allow get_instance to take WP_Network object as a param.

 Can you expand on why this might be necessary? My recent thought has been
 to follow the pattern laid out in `WP_Post` and `WP_Comment` which both
 have a `get_instance()` method that only accepts an ID. We could probably
 even change this to be more explicit and reject anything that isn't `int`
 in the first version.

 > - Added pre_get_network filter in get_instance method, so you can short-
 circuit. Based on pre_get_network_by_path

 I'm not sure we should have this available just yet. First because we
 should hold on introducing any new filters for a future commit. Second,
 because I'm not sure if I see this as needing to be short-circuited.
 Definitely welcome varying opinions on this though.

 > - get_core_option_keys method also now has a filter.

 Another to save for a future ticket or future patch/commit on this ticket
 once we get `WP_Network` in. `get_core_option_keys` and
 `load_core_options` are explicit in that they are processing the core
 defined option keys. If we do add a filter for this, we should wait until
 the class has been implemented.

 > I also think that the method load_core_options shouldn't use a raw SQL
 query like this. It should use the get_site_option function, as this has
 filters that should be applied. Maybe get_site_option should allow site id
 / network id to be passed to it?

 The purpose of `wp_load_core_options()` is really only to prime non-
 persistent cache for a network's options when it is loaded. That it's
 there at all is somewhat strange to me. :) I definitely think there's room
 for a future ticket where we add better `get_site_option()` support and
 allow a network ID to be passed.

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


More information about the wp-trac mailing list