WP_CLI\Utils
wp_not_installed()
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wp_not_installed();
Код wp_not_installed() wp not installed WP-CLI 2.13.0-alpha
function wp_not_installed() {
global $wpdb, $table_prefix;
if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {
$tables = $wpdb->get_col( "SHOW TABLES LIKE '%_options'" );
$found_prefixes = [];
if ( count( $tables ) ) {
foreach ( $tables as $table ) {
$maybe_prefix = substr( $table, 0, - strlen( 'options' ) );
if ( $maybe_prefix !== $table_prefix ) {
$found_prefixes[] = $maybe_prefix;
}
}
}
if ( count( $found_prefixes ) ) {
sort( $found_prefixes );
$prefix_list = implode( ', ', $found_prefixes );
$install_label = count( $found_prefixes ) > 1 ? 'installations' : 'installation';
WP_CLI::error(
"The site you have requested is not installed.\n" .
"Your table prefix is '{$table_prefix}'. Found {$install_label} with table prefix: {$prefix_list}.\n" .
'Or, run `wp core install` to create database tables.'
);
} else {
WP_CLI::error(
"The site you have requested is not installed.\n" .
'Run `wp core install` to create database tables.'
);
}
}
}