ms_not_installed( string $domain, string $path )
- Since
- 3.0.0, 4.4.0
- Source
wp-includes/ms-load.php:466
Description
Used when a blog's tables do not exist. Checks for a missing $wpdb->site table as well.
Compatibility
- WordPress
- since 4.4.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$domainstring- The requested domain for the error to reference.
$pathstring- The requested path for the error to reference.
Performance profile
How much work a call to ms_not_installed() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Heavy
- Scaling
- Scales with input
- Instructions
- 89–103
- Plugin surface
- None
- Called by
- 0
Reaches the database via ->get_var().
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 124.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- sqldatabase query
->get_var()called directly - hookthird-party callbacks
apply_filters()one call below ms_not_installed()
Further down the call graph this can also reach query, option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 4 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost ms_not_installed() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
is_admin() && !->get_var() | 89–90 | is_admin(), wp_load_translations_early(), __(), __(), __(), ->esc_like(), ->prepare(), ->get_var(), __(), sprintf(), __(), __(), __(), sprintf(), __(), ->tables(), wp_die() |
!is_admin() && !->get_var() | 91–92 | is_admin(), dead_db(), wp_load_translations_early(), __(), __(), __(), ->esc_like(), ->prepare(), ->get_var(), __(), sprintf(), __(), __(), __(), sprintf(), __(), ->tables(), wp_die() |
is_admin() && ->get_var() | 100–101 | is_admin(), wp_load_translations_early(), __(), __(), __(), ->esc_like(), ->prepare(), ->get_var(), __(), rtrim(), sprintf(), __(), __(), __(), sprintf(), __(), ->tables(), wp_die() |
!is_admin() && ->get_var() | 102–103 | is_admin(), dead_db(), wp_load_translations_early(), __(), __(), __(), ->esc_like(), ->prepare(), ->get_var(), __(), rtrim(), sprintf(), __(), __(), __(), sprintf(), __(), ->tables(), wp_die() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 124 instructions, 89–103 executed per call, 5 branches. The work does not change between versions.
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 5
- is_admin()Determines whether the current request is for an administrative interface page.
- dead_db()Loads custom DB error or display WordPress DB error.
- wp_load_translations_early()Attempts an early load of translations.
- __()Retrieves the translation of $text.
- wp_die()Kills WordPress execution and displays HTML page with an error message.
Source code
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 your host’s database server 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 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.' ), '<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> '; $msg .= sprintf( /* translators: %s: Documentation URL. */ __( 'Read the <a href="%s" target="_blank">Debugging a WordPress Network</a> article. Some of the suggestions there may help you figure out what went wrong.' ), __( 'https://developer.wordpress.org/advanced-administration/debug/debug-network/' ) ); $msg .= ' ' . __( 'If you are 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 ) );}Changelog
Introduced in 3.0.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
none to never.verified against source$domain and $path parameters were added.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-includes/ms-load.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.