Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ public function create( $args, $assoc_args ) {
$network_admin_id = get_current_user_id();
}

$clone_network = $assoc_args['clone_network'];
$options_to_clone = false;
$clone_network = $assoc_args['clone_network'];

if ( ! empty( $clone_network ) && ! get_network( $clone_network ) ) {
if ( ! empty( $clone_network ) && is_numeric( $clone_network ) && ! get_network( $clone_network ) ) {
WP_CLI::error( sprintf( "Clone network %s doesn't exist.", $clone_network ) );
}

Expand All @@ -98,7 +97,7 @@ public function create( $args, $assoc_args ) {
'user_id' => get_current_user_id(),
'network_admin_id' => $network_admin_id,
'clone_network' => $clone_network,
'options_to_clone' => $options_to_clone,
'options_to_clone' => $assoc_args['options_to_clone'],
)
);

Expand Down Expand Up @@ -264,9 +263,11 @@ public function list_( $args, $assoc_args ) {
public function plugin( $args, $assoc_args ) {
$fetchers_plugin = new \WP_CLI\Fetchers\Plugin();
$action = array_shift( $args );

if ( ! in_array( $action, array( 'activate', 'deactivate' ), true ) ) {
WP_CLI::error( sprintf( '%s is not a supported action.', $action ) );
}

$network_wide = \WP_CLI\Utils\get_flag_value( $assoc_args, 'network' );
$all = \WP_CLI\Utils\get_flag_value( $assoc_args, 'all', false );

Expand Down
5 changes: 2 additions & 3 deletions wp-multi-network/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,8 @@ function add_network( $args = array() ) {
$new_siteurl = untrailingslashit( get_blogaddress_by_id( $new_blog_id ) );
$upload_url = str_replace( $current_siteurl, $new_siteurl, content_url() );
$upload_url = $upload_url . '/uploads';

$upload_dir = WP_CONTENT_DIR;
$needle = strval( ABSPATH );
$upload_dir = WP_CONTENT_DIR;
$needle = strval( ABSPATH );
if ( 0 === strpos( $upload_dir, $needle ) ) {
$upload_dir = substr( $upload_dir, strlen( $needle ) );
}
Expand Down
Loading