ms_not_installed

Displays a failure message.

Description

ms_not_installed( (string) $domain, (string) $path ); 

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

Parameters (2)

0. $domain (string)
The requested domain for the error to reference.
1. $path (string)
The requested path for the error to reference.

Usage

  1. if ( !function_exists( 'ms_not_installed' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-load.php'; 
  3.  
  4. // The requested domain for the error to reference. 
  5. $domain = ''; 
  6.  
  7. // The requested path for the error to reference. 
  8. $path = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = ms_not_installed($domain, $path); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-load.php  
  1. function ms_not_installed( $domain, $path ) { 
  2. global $wpdb; 
  3.  
  4. if ( ! is_admin() ) { 
  5. dead_db(); 
  6.  
  7.  
  8. $title = __( 'Error establishing a database connection' ); 
  9.  
  10. $msg = '<h1>' . $title . '</h1>'; 
  11. $msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . ''; 
  12. $msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables areerrorfree.' ) . '</p>'; 
  13. $query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) ); 
  14. if ( ! $wpdb->get_var( $query ) ) { 
  15. $msg .= '<p>' . sprintf( 
  16. /** translators: %s: table name */ 
  17. __( '<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.' ),  
  18. '<code>' . $wpdb->site . '</code>' 
  19. ) . '</p>'; 
  20. } else { 
  21. $msg .= '<p>' . sprintf( 
  22. /** translators: 1: site url, 2: table name, 3: database name */ 
  23. __( '<strong>Could not find site %1$s.</strong> Searched for table %2$s in database %3$s. Is that right?' ),  
  24. '<code>' . rtrim( $domain . $path, '/' ) . '</code>',  
  25. '<code>' . $wpdb->blogs . '</code>',  
  26. '<code>' . DB_NAME . '</code>' 
  27. ) . '</p>'; 
  28. $msg .= '<p><strong>' . __( 'What do I do now?' ) . '</strong> '; 
  29. /** translators: %s: Codex URL */ 
  30. $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.' ),  
  31. __( 'https://codex.wordpress.org/Debugging_a_WordPress_Network' ) 
  32. ); 
  33. $msg .= ' ' . __( 'If you’re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>'; 
  34. foreach ( $wpdb->tables('global') as $t => $table ) { 
  35. if ( 'sitecategories' == $t ) 
  36. continue; 
  37. $msg .= '<li>' . $table . '</li>'; 
  38. $msg .= '</ul>'; 
  39.  
  40. wp_die( $msg, $title, array( 'response' => 500 ) );