Multisite: Remove references to `$wpdb->siteid` and use `get_current_network_id()` instead.
Props sathyapulse, spacedmonkey. Fixes #41507. Built from https://develop.svn.wordpress.org/trunk@41242 git-svn-id: http://core.svn.wordpress.org/trunk@41082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
820d3973a3
commit
473e1ba73b
|
@ -792,15 +792,11 @@ function choose_primary_blog() {
|
||||||
*
|
*
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
*
|
*
|
||||||
* @global wpdb $wpdb WordPress database abstraction object.
|
|
||||||
*
|
|
||||||
* @param int $network_id The network ID to check.
|
* @param int $network_id The network ID to check.
|
||||||
* @return bool True if network can be edited, otherwise false.
|
* @return bool True if network can be edited, otherwise false.
|
||||||
*/
|
*/
|
||||||
function can_edit_network( $network_id ) {
|
function can_edit_network( $network_id ) {
|
||||||
global $wpdb;
|
if ( $network_id == get_current_network_id() )
|
||||||
|
|
||||||
if ( $network_id == $wpdb->siteid )
|
|
||||||
$result = true;
|
$result = true;
|
||||||
else
|
else
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
|
@ -1091,7 +1091,7 @@ function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) {
|
||||||
if ( ! empty( $deprecated ) )
|
if ( ! empty( $deprecated ) )
|
||||||
_deprecated_argument( __FUNCTION__, 'MU' ); // never used
|
_deprecated_argument( __FUNCTION__, 'MU' ); // never used
|
||||||
|
|
||||||
return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );
|
return $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", get_current_network_id(), $start, $quantity ), ARRAY_A );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -187,7 +187,7 @@ function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
|
||||||
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' );
|
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' );
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
|
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id() ), ARRAY_A );
|
||||||
|
|
||||||
$blog_list = array();
|
$blog_list = array();
|
||||||
foreach ( (array) $blogs as $details ) {
|
foreach ( (array) $blogs as $details ) {
|
||||||
|
@ -430,7 +430,7 @@ function get_admin_users_for_domain( $domain = '', $path = '' ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
if ( ! $domain )
|
if ( ! $domain )
|
||||||
$network_id = $wpdb->siteid;
|
$network_id = get_current_network_id();
|
||||||
else
|
else
|
||||||
$network_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
|
$network_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
|
||||||
|
|
||||||
|
@ -447,8 +447,6 @@ function get_admin_users_for_domain( $domain = '', $path = '' ) {
|
||||||
* @deprecated 4.6.0 Use get_sites()
|
* @deprecated 4.6.0 Use get_sites()
|
||||||
* @see get_sites()
|
* @see get_sites()
|
||||||
*
|
*
|
||||||
* @global wpdb $wpdb WordPress database abstraction object.
|
|
||||||
*
|
|
||||||
* @param array $args {
|
* @param array $args {
|
||||||
* Array of default arguments. Optional.
|
* Array of default arguments. Optional.
|
||||||
*
|
*
|
||||||
|
@ -468,15 +466,13 @@ function get_admin_users_for_domain( $domain = '', $path = '' ) {
|
||||||
* values for whether the site is public, archived, mature, spam, and/or deleted.
|
* values for whether the site is public, archived, mature, spam, and/or deleted.
|
||||||
*/
|
*/
|
||||||
function wp_get_sites( $args = array() ) {
|
function wp_get_sites( $args = array() ) {
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
_deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' );
|
_deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' );
|
||||||
|
|
||||||
if ( wp_is_large_network() )
|
if ( wp_is_large_network() )
|
||||||
return array();
|
return array();
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'network_id' => $wpdb->siteid,
|
'network_id' => get_current_network_id(),
|
||||||
'public' => null,
|
'public' => null,
|
||||||
'archived' => null,
|
'archived' => null,
|
||||||
'mature' => null,
|
'mature' => null,
|
||||||
|
|
|
@ -72,7 +72,7 @@ function get_active_blog_for_user( $user_id ) {
|
||||||
$ret = false;
|
$ret = false;
|
||||||
if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
|
if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
|
||||||
foreach ( (array) $blogs as $blog_id => $blog ) {
|
foreach ( (array) $blogs as $blog_id => $blog ) {
|
||||||
if ( $blog->site_id != $wpdb->siteid )
|
if ( $blog->site_id != get_current_network_id() )
|
||||||
continue;
|
continue;
|
||||||
$details = get_site( $blog_id );
|
$details = get_site( $blog_id );
|
||||||
if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
|
if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
|
||||||
|
@ -1089,7 +1089,7 @@ function wpmu_activate_signup($key) {
|
||||||
return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta );
|
return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta );
|
||||||
}
|
}
|
||||||
|
|
||||||
$blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid );
|
$blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, get_current_network_id() );
|
||||||
|
|
||||||
// TODO: What to do if we create a user but cannot create a blog?
|
// TODO: What to do if we create a user but cannot create a blog?
|
||||||
if ( is_wp_error($blog_id) ) {
|
if ( is_wp_error($blog_id) ) {
|
||||||
|
|
|
@ -223,7 +223,7 @@ function wp_load_core_site_options( $network_id = null ) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( empty($network_id) )
|
if ( empty($network_id) )
|
||||||
$network_id = $wpdb->siteid;
|
$network_id = get_current_network_id();
|
||||||
|
|
||||||
$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
|
$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-alpha-41241';
|
$wp_version = '4.9-alpha-41242';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
|
@ -354,7 +354,7 @@ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
|
||||||
* The function halts all execution if the user is not logged in.
|
* The function halts all execution if the user is not logged in.
|
||||||
*/
|
*/
|
||||||
function validate_another_blog_signup() {
|
function validate_another_blog_signup() {
|
||||||
global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
|
global $blogname, $blog_title, $errors, $domain, $path;
|
||||||
$current_user = wp_get_current_user();
|
$current_user = wp_get_current_user();
|
||||||
if ( ! is_user_logged_in() ) {
|
if ( ! is_user_logged_in() ) {
|
||||||
die();
|
die();
|
||||||
|
@ -422,7 +422,7 @@ function validate_another_blog_signup() {
|
||||||
*/
|
*/
|
||||||
$meta = apply_filters( 'add_signup_meta', $meta_defaults );
|
$meta = apply_filters( 'add_signup_meta', $meta_defaults );
|
||||||
|
|
||||||
$blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
|
$blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, get_current_network_id() );
|
||||||
|
|
||||||
if ( is_wp_error( $blog_id ) ) {
|
if ( is_wp_error( $blog_id ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue