显示失败消息。

原型

ms_not_installed( string $domain, string $path )

描述

在博客表不存在时使用。检查缺少的$ wpdb-> site表。

参数

$domain (string) (Required) 要求引用的错误的域。

$path (string) (Required) 请求引用错误的路径。

源文件

路径:wp-includes/ms-load.php

<?php
...
function ms_not_installed( $domain, $path ) {
	global $wpdb;
	if ( ! is_admin() ) {
		dead_db();
	}
	wp_load_translations_early();
	$title = __( 'Error establishing a database connection' );
	$msg  = '<h1>' . $title . '</h1>';
	$msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
	$msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '</p>';
	$query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
	if ( ! $wpdb->get_var( $query ) ) {
		$msg .= '<p>' . sprintf(
			/* 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 */
			__( '<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>',
			'<code>' . DB_NAME . '</code>'
		) . '</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' )
	);
	$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 )
			continue;
		$msg .= '<li>' . $table . '</li>';
	}
	$msg .= '</ul>';
	wp_die( $msg, $title, array( 'response' => 500 ) );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/ms_not_installed/