Code Duplication    Length = 5-7 lines in 5 locations

engine/classes/ElggInstaller.php 5 locations

@@ 1392-1396 (lines=5) @@
1389
1390
		// check that data root is absolute path
1391
		if (stripos(PHP_OS, 'win') === 0) {
1392
			if (strpos($submissionVars['dataroot'], ':') !== 1) {
1393
				$msg = _elgg_services()->translator->translate('install:error:relative_path', array($submissionVars['dataroot']));
1394
				register_error($msg);
1395
				return FALSE;
1396
			}
1397
		} else {
1398
			if (strpos($submissionVars['dataroot'], '/') !== 0) {
1399
				$msg = _elgg_services()->translator->translate('install:error:relative_path', array($submissionVars['dataroot']));
@@ 1397-1403 (lines=7) @@
1394
				register_error($msg);
1395
				return FALSE;
1396
			}
1397
		} else {
1398
			if (strpos($submissionVars['dataroot'], '/') !== 0) {
1399
				$msg = _elgg_services()->translator->translate('install:error:relative_path', array($submissionVars['dataroot']));
1400
				register_error($msg);
1401
				return FALSE;
1402
			}
1403
		}
1404
1405
		// check that data root exists
1406
		if (!file_exists($submissionVars['dataroot'])) {
@@ 1406-1410 (lines=5) @@
1403
		}
1404
1405
		// check that data root exists
1406
		if (!file_exists($submissionVars['dataroot'])) {
1407
			$msg = _elgg_services()->translator->translate('install:error:datadirectoryexists', array($submissionVars['dataroot']));
1408
			register_error($msg);
1409
			return FALSE;
1410
		}
1411
1412
		// check that data root is writable
1413
		if (!is_writable($submissionVars['dataroot'])) {
@@ 1413-1417 (lines=5) @@
1410
		}
1411
1412
		// check that data root is writable
1413
		if (!is_writable($submissionVars['dataroot'])) {
1414
			$msg = _elgg_services()->translator->translate('install:error:writedatadirectory', array($submissionVars['dataroot']));
1415
			register_error($msg);
1416
			return FALSE;
1417
		}
1418
1419
		if (!isset($this->CONFIG->data_dir_override) || !$this->CONFIG->data_dir_override) {
1420
			// check that data root is not subdirectory of Elgg root
@@ 1421-1425 (lines=5) @@
1418
1419
		if (!isset($this->CONFIG->data_dir_override) || !$this->CONFIG->data_dir_override) {
1420
			// check that data root is not subdirectory of Elgg root
1421
			if (stripos($submissionVars['dataroot'], $submissionVars['path']) === 0) {
1422
				$msg = _elgg_services()->translator->translate('install:error:locationdatadirectory', array($submissionVars['dataroot']));
1423
				register_error($msg);
1424
				return FALSE;
1425
			}
1426
		}
1427
1428
		// check that email address is email address