wp/wp-includes/ms-load.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-includes/ms-load.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/ms-load.php	Tue Dec 15 13:49:49 2020 +0100
@@ -20,7 +20,7 @@
 		return SUBDOMAIN_INSTALL;
 	}
 
-	return ( defined( 'VHOST' ) && VHOST == 'yes' );
+	return ( defined( 'VHOST' ) && 'yes' === VHOST );
 }
 
 /**
@@ -32,7 +32,7 @@
  * @access private
  * @since 3.1.0
  *
- * @return array Files to include.
+ * @return string[] Array of absolute paths to files to include.
  */
 function wp_get_active_network_plugins() {
 	$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
@@ -45,9 +45,9 @@
 	sort( $active_plugins );
 
 	foreach ( $active_plugins as $plugin ) {
-		if ( ! validate_file( $plugin ) // $plugin must validate as file
-			&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
-			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
+		if ( ! validate_file( $plugin )                     // $plugin must validate as file.
+			&& '.php' === substr( $plugin, -4 )             // $plugin must end with '.php'.
+			&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist.
 			) {
 			$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
 		}
@@ -78,14 +78,14 @@
 	 *
 	 * @since 3.0.0
 	 *
-	 * @param bool null Whether to skip the blog status check. Default null.
+	 * @param bool|null $check Whether to skip the blog status check. Default null.
 	 */
 	$check = apply_filters( 'ms_site_check', null );
 	if ( null !== $check ) {
 		return true;
 	}
 
-	// Allow super admins to see blocked sites
+	// Allow super admins to see blocked sites.
 	if ( is_super_admin() ) {
 		return true;
 	}
@@ -106,8 +106,8 @@
 		} else {
 			$admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) );
 			wp_die(
-				/* translators: %s: admin email link */
 				sprintf(
+					/* translators: %s: Admin email link. */
 					__( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ),
 					sprintf( '<a href="mailto:%1$s">%1$s</a>', $admin_email )
 				)
@@ -115,7 +115,7 @@
 		}
 	}
 
-	if ( $blog->archived == '1' || $blog->spam == '1' ) {
+	if ( '1' == $blog->archived || '1' == $blog->spam ) {
 		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) {
 			return WP_CONTENT_DIR . '/blog-suspended.php';
 		} else {
@@ -203,12 +203,13 @@
 	 *
 	 * @since 3.9.0
 	 *
-	 * @param null|bool|WP_Site $site     Site value to return by path.
-	 * @param string            $domain   The requested domain.
-	 * @param string            $path     The requested path, in full.
-	 * @param int|null          $segments The suggested number of paths to consult.
-	 *                                    Default null, meaning the entire path was to be consulted.
-	 * @param array             $paths    The paths to search for, based on $path and $segments.
+	 * @param null|false|WP_Site $site     Site value to return by path. Default null
+	 *                                     to continue retrieving the site.
+	 * @param string             $domain   The requested domain.
+	 * @param string             $path     The requested path, in full.
+	 * @param int|null           $segments The suggested number of paths to consult.
+	 *                                     Default null, meaning the entire path was to be consulted.
+	 * @param string[]           $paths    The paths to search for, based on $path and $segments.
 	 */
 	$pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths );
 	if ( null !== $pre ) {
@@ -220,7 +221,7 @@
 
 	/*
 	 * @todo
-	 * caching, etc. Consider alternative optimization routes,
+	 * Caching, etc. Consider alternative optimization routes,
 	 * perhaps as an opt-in for plugins, rather than using the pre_* filter.
 	 * For example: The segments filter can expand or ignore paths.
 	 * If persistent caching is enabled, we could query the DB for a path <> '/'
@@ -304,7 +305,7 @@
 		$current_site->path   = PATH_CURRENT_SITE;
 		if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
 			$current_site->blog_id = BLOG_ID_CURRENT_SITE;
-		} elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { // deprecated.
+		} elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { // Deprecated.
 			$current_site->blog_id = BLOGID_CURRENT_SITE;
 		}
 
@@ -324,7 +325,8 @@
 		 * If we're not dealing with one of these installations, then the important part is determining
 		 * the network first, because we need the network's path to identify any sites.
 		 */
-		if ( ! $current_site = wp_cache_get( 'current_network', 'site-options' ) ) {
+		$current_site = wp_cache_get( 'current_network', 'site-options' );
+		if ( ! $current_site ) {
 			// Are there even two networks installed?
 			$networks = get_networks( array( 'number' => 2 ) );
 			if ( count( $networks ) === 1 ) {
@@ -388,7 +390,8 @@
 	// During activation of a new subdomain, the requested site does not yet exist.
 	if ( empty( $current_blog ) && wp_installing() ) {
 		$current_blog          = new stdClass;
-		$current_blog->blog_id = $blog_id = 1;
+		$current_blog->blog_id = 1;
+		$blog_id               = 1;
 		$current_blog->public  = 1;
 	}
 
@@ -416,9 +419,11 @@
 			// For a "subdomain" installation, redirect to the signup form specifically.
 			$destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
 		} elseif ( $subdomain ) {
-			// For a "subdomain" installation, the NOBLOGREDIRECT constant
-			// can be used to avoid a redirect to the signup form.
-			// Using the ms_site_not_found action is preferred to the constant.
+			/*
+			 * For a "subdomain" installation, the NOBLOGREDIRECT constant
+			 * can be used to avoid a redirect to the signup form.
+			 * Using the ms_site_not_found action is preferred to the constant.
+			 */
 			if ( '%siteurl%' !== NOBLOGREDIRECT ) {
 				$destination = NOBLOGREDIRECT;
 			}
@@ -473,13 +478,13 @@
 	$query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) );
 	if ( ! $wpdb->get_var( $query ) ) {
 		$msg .= '<p>' . sprintf(
-			/* translators: %s: table name */
+			/* translators: %s: Table name. */
 			__( '<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.' ),
 			'<code>' . $wpdb->site . '</code>'
 		) . '</p>';
 	} else {
 		$msg .= '<p>' . sprintf(
-			/* translators: 1: site url, 2: table name, 3: database name */
+			/* translators: 1: Site URL, 2: Table name, 3: Database name. */
 			__( '<strong>Could not find site %1$s.</strong> Searched for table %2$s in database %3$s. Is that right?' ),
 			'<code>' . rtrim( $domain . $path, '/' ) . '</code>',
 			'<code>' . $wpdb->blogs . '</code>',
@@ -487,14 +492,14 @@
 		) . '</p>';
 	}
 	$msg .= '<p><strong>' . __( 'What do I do now?' ) . '</strong> ';
-	/* translators: %s: Codex URL */
 	$msg .= sprintf(
-		__( 'Read the <a href="%s" target="_blank">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' ),
-		__( 'https://codex.wordpress.org/Debugging_a_WordPress_Network' )
+		/* translators: %s: Documentation URL. */
+		__( 'Read the <a href="%s" target="_blank">Debugging a WordPress Network</a> article. Some of the suggestions there may help you figure out what went wrong.' ),
+		__( 'https://wordpress.org/support/article/debugging-a-wordpress-network/' )
 	);
 	$msg .= ' ' . __( 'If you&#8217;re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
 	foreach ( $wpdb->tables( 'global' ) as $t => $table ) {
-		if ( 'sitecategories' == $t ) {
+		if ( 'sitecategories' === $t ) {
 			continue;
 		}
 		$msg .= '<li>' . $table . '</li>';