Code Duplication    Length = 8-8 lines in 2 locations

includes/specials/SpecialUserrights.php 2 locations

@@ 291-298 (lines=8) @@
288
		$newGroups = $oldGroups;
289
290
		// Remove then add groups
291
		if ( $remove ) {
292
			foreach ( $remove as $index => $group ) {
293
				if ( !$user->removeGroup( $group ) ) {
294
					unset( $remove[$index] );
295
				}
296
			}
297
			$newGroups = array_diff( $newGroups, $remove );
298
		}
299
		if ( $add ) {
300
			foreach ( $add as $index => $group ) {
301
				if ( !$user->addGroup( $group ) ) {
@@ 299-306 (lines=8) @@
296
			}
297
			$newGroups = array_diff( $newGroups, $remove );
298
		}
299
		if ( $add ) {
300
			foreach ( $add as $index => $group ) {
301
				if ( !$user->addGroup( $group ) ) {
302
					unset( $add[$index] );
303
				}
304
			}
305
			$newGroups = array_merge( $newGroups, $add );
306
		}
307
		$newGroups = array_unique( $newGroups );
308
309
		// Ensure that caches are cleared