[wp-trac] [WordPress Trac] #40364: Improve site creation in multisite

WordPress Trac noreply at wordpress.org
Wed Jul 11 09:22:23 UTC 2018


#40364: Improve site creation in multisite
-------------------------------------------------+------------------------
 Reporter:  jeremyfelt                           |       Owner:  flixos90
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.0
Component:  Networks and Sites                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  ms-roadmap has-patch has-unit-tests  |     Focuses:  multisite
-------------------------------------------------+------------------------

Comment (by spacedmonkey):

 Looking good!

 I think we are nearly there.
 I noticed in `wp_update_site` that there are the following lines

 {{{#!php
 $whitelist = array( 'domain', 'path', 'network_id', 'registered',
 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted',
 'lang_id' );
 $data = array_intersect_key( wp_parse_args( $data, $defaults ),
 array_flip( $whitelist ) );
 }}}

 I believe the same whitelisting should be applied in `wp_insert_site`.
 This would fix my issue with an id being passed to the `wp_insert_site`
 function.

 As an idea, we could do this. Change the filter to this

 {{{#!php
 $data = apply_filters( 'wp_normalize_site_data', $data, $defaults );
 }}}

 and then move this

 {{{#!php
 $whitelist = array( 'domain', 'path', 'network_id', 'registered',
 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted',
 'lang_id' );
 $data = array_intersect_key( wp_parse_args( $data, $defaults ),
 array_flip( $whitelist ) );
 }}}

 into `wp_normalize_site_data` to stop repeated code.

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


More information about the wp-trac mailing list