Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ private function multisite_convert_( $assoc_args ) {
$wp_config_path = Utils\locate_wp_config();
if ( true === Utils\get_flag_value( $assoc_args, 'skip-config' ) ) {
WP_CLI::log( "Addition of multisite constants to 'wp-config.php' skipped. You need to add them manually:\n{$ms_config}" );
} elseif ( is_writable( $wp_config_path ) && self::modify_wp_config( $ms_config ) ) {
} elseif ( false !== $wp_config_path && is_writable( $wp_config_path ) && self::modify_wp_config( $ms_config ) ) {
WP_CLI::log( "Added multisite constants to 'wp-config.php'." );
} else {
WP_CLI::warning( "Multisite constants could not be written to 'wp-config.php'. You may need to add them manually:\n{$ms_config}" );
Expand Down Expand Up @@ -996,6 +996,9 @@ private static function add_site_admins( $site_user ) {

private static function modify_wp_config( $content ) {
$wp_config_path = Utils\locate_wp_config();
if ( false === $wp_config_path ) {
return false;
}

$token = "/* That's all, stop editing!";
$config_contents = (string) file_get_contents( $wp_config_path );
Expand Down
Loading