[wp-trac] [WordPress Trac] #41333: Implement `wp_initialize_site()` and `wp_uninitialize_site()`
WordPress Trac
noreply at wordpress.org
Mon Sep 10 21:42:04 UTC 2018
#41333: Implement `wp_initialize_site()` and `wp_uninitialize_site()`
-------------------------------------------------+-------------------------
Reporter: flixos90 | Owner: flixos90
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.0
Component: Networks and Sites | Version:
Severity: normal | Resolution:
Keywords: ms-roadmap has-patch needs-unit- | Focuses: multisite
tests needs-testing needs-dev-note |
-------------------------------------------------+-------------------------
Comment (by spacedmonkey):
I reviewed the latest patch, here is my feedback.
{{{#!php
if ( 'https' === parse_url( get_network_option( $network->id, 'siteurl' ),
PHP_URL_SCHEME ) ) {
}}}
should become
{{{#!php
if ( 'https' === parse_url( $network->siteurl, PHP_URL_SCHEME ) ) {
}}}
The function `install_blog_defaults` needs this
{{{#!php
_deprecated_function( __FUNCTION__, '5.0.0' );
}}}
Breaks this into multiple lines to make it more readable.
{{{#!php
$blog_id = wp_insert_site(
array_merge(
$site_data,
array(
'title' => $title,
'user_id' => $user_id,
'options' =>
array_diff_key( $options, array_flip( $site_data_whitelist ) ),
)
)
);
}}}
becomes
{{{#!php
$site_data_default = array(
'title' => $title,
'user_id' => $user_id,
'options' => array_diff_key( $options,
array_flip( $site_data_whitelist ) ),
);
$blog_options = array_merge( $site_data, $site_data_default );
$blog_id = wp_insert_site( $blog_options);
}}}
I would change the following as well
{{{#!php
$result = false;
$suppress = $wpdb->suppress_errors();
if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) ) {
$result = true;
}
$wpdb->suppress_errors( $suppress );
}}}
becomes
{{{#!php
$suppress = $wpdb->suppress_errors();
$result = $wpdb->get_results( "DESCRIBE {$wpdb->posts}" );
$wpdb->suppress_errors( $suppress );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41333#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list