ms_not_installed

函数


ms_not_installed ( $domain, $path )
Access
Private
参数
  • (string)
    $domain
    The requested domain for the error to reference.
    Required:
  • (string)
    $path
    The requested path for the error to reference.
    Required:
定义位置
  • wp-includes/ms-load.php
    , line 462
引入
3.0.0
弃用

Displays a failure message.

Used when a blog’s tables do not exist. Checks for a missing $wpdb->site table as well.

function ms_not_installed( $domain, $path ) {
	global $wpdb;

	if ( ! is_admin() ) {
		dead_db();
	}

	wp_load_translations_early();

	$title = __( 'Error establishing a database connection' );

	$msg   = '

' . $title . '

'; $msg .= '

' . __( '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 your host’s database server is running properly and all tables are error free.' ) . '

'; $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) ); if ( ! $wpdb->get_var( $query ) ) { $msg .= '

' . sprintf( /* translators: %s: Table name. */ __( 'Database tables are missing. This means that your host’s database server is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.' ), '' . $wpdb->site . '' ) . '

'; } else { $msg .= '

' . sprintf( /* translators: 1: Site URL, 2: Table name, 3: Database name. */ __( 'Could not find site %1$s. Searched for table %2$s in database %3$s. Is that right?' ), '' . rtrim( $domain . $path, '/' ) . '', '' . $wpdb->blogs . '', '' . DB_NAME . '' ) . '

'; } $msg .= '

' . __( 'What do I do now?' ) . ' '; $msg .= sprintf( /* translators: %s: Documentation URL. */ __( 'Read the Debugging a WordPress Network 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 are still stuck with this message, then check that your database contains the following tables:' ) . '

    ‘;
    foreach ( $wpdb->tables( ‘global’ ) as $t => $table ) {
    if ( ‘sitecategories’ === $t ) {
    continue;
    }
    $msg .= ‘
  • ‘ . $table . ‘
  • ‘;
    }
    $msg .= ‘

‘;

wp_die( $msg, $title, array( ‘response’ => 500 ) );
}