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

@@ 1083-1088 (lines=6) @@
1080
				? array( 'sso' )
1081
				: array();
1082
1083
			if ( $active_modules = Jetpack_Options::get_option( 'active_modules' ) ) {
1084
				Jetpack::delete_active_modules();
1085
				Jetpack::activate_default_modules( 999, 1, array_merge( $active_modules, $other_modules ), false );
1086
			} else {
1087
				Jetpack::activate_default_modules( false, false, $other_modules, false );
1088
			}
1089
		}
1090
1091
		WP_CLI::log( json_encode( $body_json ) );