Code Duplication    Length = 6-7 lines in 2 locations

class.jetpack-client-server.php 1 location

@@ 149-155 (lines=7) @@
146
			: array();
147
148
		$redirect_on_activation_error = ( 'client' === $data['auth_type'] ) ? true : false;
149
		if ( $active_modules = Jetpack_Options::get_option( 'active_modules' ) ) {
150
			Jetpack::delete_active_modules();
151
152
			Jetpack::activate_default_modules( 999, 1, array_merge( $active_modules, $other_modules ), $redirect_on_activation_error, false );
153
		} else {
154
			Jetpack::activate_default_modules( false, false, $other_modules, $redirect_on_activation_error, false );
155
		}
156
157
		// Since this is a fresh connection, be sure to clear out IDC options
158
		Jetpack_IDC::clear_all_idc_options();

class.jetpack-cli.php 1 location

@@ 1045-1050 (lines=6) @@
1042
				? array( 'sso' )
1043
				: array();
1044
1045
			if ( $active_modules = Jetpack_Options::get_option( 'active_modules' ) ) {
1046
				Jetpack::delete_active_modules();
1047
				Jetpack::activate_default_modules( 999, 1, array_merge( $active_modules, $other_modules ), false );
1048
			} else {
1049
				Jetpack::activate_default_modules( false, false, $other_modules, false );
1050
			}
1051
		}
1052
1053
		WP_CLI::log( json_encode( $body_json ) );