Make WordPress Core

Changeset 14317


Ignore:
Timestamp:
04/30/2010 03:21:10 PM (15 years ago)
Author:
nacin
Message:

Prune and tidy the message in ms_not_installed. Only show detailed information if wp-admin, likesingle installs. Use ->tables. @todo: non-'MU' codex link.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-load.php

    r14313 r14317  
    190190 * Displays a failure message.
    191191 *
    192  * Used when blog does not exist. Checks for a missing $wpdb->site table as well.
    193  *
    194  * @todo update for 3.0, pare down, and i18n
     192 * Used when a blog's tables do not exist. Checks for a missing $wpdb->site table as well.
     193 *
     194 * @todo update Codex link for 3.0.0
    195195 *
    196196 * @access private
     
    200200    global $wpdb, $domain, $path;
    201201
    202     $msg = '<h1>' . /*WP_I18N_FATAL_ERROR*/'Fatal Error'/*/WP_I18N_FATAL_ERROR*/ . '</h1>';
    203     $msg .= '<p>' . /*WP_I18N_CONTACT_OWNER*/'If your site does not display, please contact the owner of this network.'/*/WP_I18N_CONTACT_OWNER*/ . '</p>';
    204     $msg .= '<p>' . /*WP_I18N_CHECK_MYSQL*/'If you are the owner of this network please check that MySQL is running properly and all tables are error free.'/*/WP_I18N_CHECK_MYSQL*/ . '</p>';
    205     if ( !$wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
    206         $msg .= '<p>' . sprintf( /*WP_I18N_TABLES_MISSING_LONG*/'<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted <code>%s</code>. You really <em>should</em> look at your database now.'/*/WP_I18N_TABLES_MISSING_LONG*/, $wpdb->site ) . '</p>';
     202    $msg  = '<h1>' . /*WP_I18N_FATAL_ERROR*/'Error establishing database connection'/*/WP_I18N_FATAL_ERROR*/ . '</h1>';
     203    if ( ! is_admin() )
     204        die( $msg );
     205    $msg .= '<p>' . /*WP_I18N_CONTACT_OWNER*/'If your site does not display, please contact the owner of this network.'/*/WP_I18N_CONTACT_OWNER*/ . '';
     206    $msg .= ' ' . /*WP_I18N_CHECK_MYSQL*/'If you are the owner of this network please check that MySQL is running properly and all tables are error free.'/*/WP_I18N_CHECK_MYSQL*/ . '</p>';
     207    if ( false && !$wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) )
     208        $msg .= '<p>' . sprintf( /*WP_I18N_TABLES_MISSING_LONG*/'<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted <code>%s</code>. You really should look at your database now.'/*/WP_I18N_TABLES_MISSING_LONG*/, $wpdb->site ) . '</p>';
    207209    else
    208         $msg .= '<p>' . sprintf( /*WP_I18N_NO_SITE_FOUND*/'<strong>Could Not Find Site!</strong> Searched for table <em>%1$s</em> in <code>%2$s</code>. Is that right?'/*/WP_I18N_NO_SITE_FOUND*/, $domain . $path, DB_NAME, $wpdb->blogs ) . '</p>';
    209     $msg .= '<h1>' . /*WP_I18N_WHAT_DO_I_DO*/'What do I do now?'/*WP_I18N_WHAT_DO_I_DO*/ . '</h1>';
    210     // @todo Update WPMU codex link.
    211     $msg .= '<p>' . /*WP_I18N_RTFM*/'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.'/*/WP_I18N_RTFM*/ . '</p>';
    212     $msg .= '<p>' . /*WP_I18N_STUCK*/'If you&#8217;re still stuck with this message, then check that your database contains the following tables:'/*/WP_I18N_STUCK*/ . '</p><ul>';
    213     foreach ( $wpdb->global_tables as $table ) {
    214         $msg .= '<li>' . $wpdb->prefix . $table . '</li>';
     210        $msg .= '<p>' . sprintf( /*WP_I18N_NO_SITE_FOUND*/'<strong>Could not find site <code>%1$s</code>.</strong> Searched for table <code>%2$s</code> in <code>%3$s</code>. Is that right?'/*/WP_I18N_NO_SITE_FOUND*/, rtrim( $domain . $path, '/' ), DB_NAME, $wpdb->blogs ) . '</p>';
     211    $msg .= '<p><strong>' . /*WP_I18N_WHAT_DO_I_DO*/'What do I do now?'/*WP_I18N_WHAT_DO_I_DO*/ . '</strong> ';
     212    $msg .= /*WP_I18N_RTFM*/'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.'/*/WP_I18N_RTFM*/;
     213    $msg .= ' ' . /*WP_I18N_STUCK*/'If you&#8217;re still stuck with this message, then check that your database contains the following tables:'/*/WP_I18N_STUCK*/ . '</p><ul>';
     214    foreach ( $wpdb->tables('global') as $t => $table ) {
     215        if ( 'sitecategories' == $t )
     216            continue;
     217        $msg .= '<li>' . $table . '</li>';
    215218    }
    216219    $msg .= '</ul>';
    217     // @todo Update WPMU codex link and support instructions.
    218     $msg .= '<p>' . /*WP_I18N_MS_FORUMS*/'If you suspect a problem please report it to the support forums but you must include the information asked for in the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">WPMU bug reporting guidelines</a>!'/*/WP_I18N_MS_FORUMS*/ . '</p>';
    219 
    220     die( $msg );
    221 }
     220
     221    wp_die( $msg, $title );
     222}
Note: See TracChangeset for help on using the changeset viewer.