Code Duplication    Length = 34-35 lines in 2 locations

apps/files_external/lib/config.php 2 locations

@@ 337-371 (lines=35) @@
334
		$mountPoints = self::readData();
335
		$backends = self::getBackends();
336
		$system = array();
337
		if (isset($mountPoints[self::MOUNT_TYPE_GROUP])) {
338
			foreach ($mountPoints[self::MOUNT_TYPE_GROUP] as $group => $mounts) {
339
				foreach ($mounts as $mountPoint => $mount) {
340
					// Update old classes to new namespace
341
					if (strpos($mount['class'], 'OC_Filestorage_') !== false) {
342
						$mount['class'] = '\OC\Files\Storage\\' . substr($mount['class'], 15);
343
					}
344
					$mount['options'] = self::decryptPasswords($mount['options']);
345
					if (!isset($mount['priority'])) {
346
						$mount['priority'] = $backends[$mount['class']]['priority'];
347
					}
348
					// Remove '/$user/files/' from mount point
349
					$mountPoint = substr($mountPoint, 13);
350
351
					$config = array(
352
						'class' => $mount['class'],
353
						'mountpoint' => $mountPoint,
354
						'backend' => $backends[$mount['class']]['backend'],
355
						'priority' => $mount['priority'],
356
						'options' => $mount['options'],
357
						'applicable' => array('groups' => array($group), 'users' => array()),
358
						'status' => self::getBackendStatus($mount['class'], $mount['options'], false)
359
					);
360
					$hash = self::makeConfigHash($config);
361
					// If an existing config exists (with same class, mountpoint and options)
362
					if (isset($system[$hash])) {
363
						// add the groups into that config
364
						$system[$hash]['applicable']['groups']
365
							= array_merge($system[$hash]['applicable']['groups'], array($group));
366
					} else {
367
						$system[$hash] = $config;
368
					}
369
				}
370
			}
371
		}
372
		if (isset($mountPoints[self::MOUNT_TYPE_USER])) {
373
			foreach ($mountPoints[self::MOUNT_TYPE_USER] as $user => $mounts) {
374
				foreach ($mounts as $mountPoint => $mount) {
@@ 372-405 (lines=34) @@
369
				}
370
			}
371
		}
372
		if (isset($mountPoints[self::MOUNT_TYPE_USER])) {
373
			foreach ($mountPoints[self::MOUNT_TYPE_USER] as $user => $mounts) {
374
				foreach ($mounts as $mountPoint => $mount) {
375
					// Update old classes to new namespace
376
					if (strpos($mount['class'], 'OC_Filestorage_') !== false) {
377
						$mount['class'] = '\OC\Files\Storage\\' . substr($mount['class'], 15);
378
					}
379
					$mount['options'] = self::decryptPasswords($mount['options']);
380
					if (!isset($mount['priority'])) {
381
						$mount['priority'] = $backends[$mount['class']]['priority'];
382
					}
383
					// Remove '/$user/files/' from mount point
384
					$mountPoint = substr($mountPoint, 13);
385
					$config = array(
386
						'class' => $mount['class'],
387
						'mountpoint' => $mountPoint,
388
						'backend' => $backends[$mount['class']]['backend'],
389
						'priority' => $mount['priority'],
390
						'options' => $mount['options'],
391
						'applicable' => array('groups' => array(), 'users' => array($user)),
392
						'status' => self::getBackendStatus($mount['class'], $mount['options'], false)
393
					);
394
					$hash = self::makeConfigHash($config);
395
					// If an existing config exists (with same class, mountpoint and options)
396
					if (isset($system[$hash])) {
397
						// add the users into that config
398
						$system[$hash]['applicable']['users']
399
							= array_merge($system[$hash]['applicable']['users'], array($user));
400
					} else {
401
						$system[$hash] = $config;
402
					}
403
				}
404
			}
405
		}
406
		return array_values($system);
407
	}
408