ms_not_installed()

最后更新于:2021-11-27 16:25:36

ms_not_installed( string$domain, string$path)

Displays a failure message.

参数

$domain

(string) (Required) The requested domain for the error to reference.

$path

(string) (Required) The requested path for the error to reference.

源文件

文件: gc-includes/ms-load.php

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

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

	gc_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 = $gcdb->prepare( 'SHOW TABLES LIKE %s', $gcdb->esc_like( $gcdb->site ) );
	if ( ! $gcdb->get_var( $query ) ) {
		$msg .= '<p>' . sprintf(
			/* translators: %s: Table name. */
			__( '<strong>Database tables are missing.</strong> This means that MySQL is not running, GeChiUI was not installed properly, or someone deleted %s. You really should look at your database now.' ),
			'<code>' . $gcdb->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>' . $gcdb->blogs . '</code>',
			'<code>' . DB_NAME . '</code>'
		) . '</p>';
	}
	$msg .= '<p><strong>' . __( 'What do I do now?' ) . '</strong> ';
	$msg .= sprintf(
		/* translators: %s: Documentation URL. */
		__( 'Read the <a href="https://docs.gechiui.com/functions/ms_not_installed/%s" target="_blank">Debugging a GeChiUI Network</a> article. Some of the suggestions there may help you figure out what went wrong.' ),
		__( 'https://gechiui.org/support/article/debugging-a-gechiui-network/' )
	);
	$msg .= ' ' . __( 'If you&#8217;re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
	foreach ( $gcdb->tables( 'global' ) as $t => $table ) {
		if ( 'sitecategories' === $t ) {
			continue;
		}
		$msg .= '<li>' . $table . '</li>';
	}
	$msg .= '</ul>';

	gc_die( $msg, $title, array( 'response' => 500 ) );
}