Code Duplication    Length = 5-5 lines in 4 locations

projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php 2 locations

@@ 224-228 (lines=5) @@
221
222
			$result = activate_plugin( $plugin, '', $this->network_wide );
223
224
			if ( is_wp_error( $result ) ) {
225
				$this->log[$plugin]['error'] = $result->get_error_messages();
226
				$has_errors                  = true;
227
				continue;
228
			}
229
230
			$success = Jetpack::is_plugin_active( $plugin );
231
			if ( $success && $this->network_wide ) {
@@ 235-239 (lines=5) @@
232
				$success &= is_plugin_active_for_network( $plugin );
233
			}
234
235
			if ( ! $success ) {
236
				$this->log[$plugin]['error'] = $result->get_error_messages;
237
				$has_errors                  = true;
238
				continue;
239
			}
240
			$this->log[$plugin][] = __( 'Plugin activated.', 'jetpack' );
241
		}
242

projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-v1-2-endpoint.php 2 locations

@@ 140-144 (lines=5) @@
137
138
			$result = activate_plugin( $plugin, '', $this->network_wide );
139
140
			if ( is_wp_error( $result ) ) {
141
				$this->log[ $plugin ]['error'] = $result->get_error_messages();
142
143
				$has_errors = true;
144
				continue;
145
			}
146
147
			$success = Jetpack::is_plugin_active( $plugin );
@@ 152-156 (lines=5) @@
149
				$success &= is_plugin_active_for_network( $plugin );
150
			}
151
152
			if ( ! $success ) {
153
				$this->log[ $plugin ]['error'] = $result->get_error_messages;
154
155
				$has_errors = true;
156
				continue;
157
			}
158
			$this->log[ $plugin ][] = __( 'Plugin activated.', 'jetpack' );
159
		}