Code Duplication    Length = 14-14 lines in 2 locations

console.php 1 location

@@ 28-41 (lines=14) @@
25
		exit(0);
26
	}
27
28
	if (!OC_Util::runningOnWindows())  {
29
		if (!function_exists('posix_getuid')) {
30
			echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
31
			exit(0);
32
		}
33
		$user = posix_getpwuid(posix_getuid());
34
		$configUser = posix_getpwuid(fileowner(OC::$SERVERROOT . '/config/config.php'));
35
		if ($user['name'] !== $configUser['name']) {
36
			echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL;
37
			echo "Current user: " . $user['name'] . PHP_EOL;
38
			echo "Web server user: " . $configUser['name'] . PHP_EOL;
39
			exit(0);
40
		}
41
	}
42
43
	// only load apps if no update is due,
44
	// else only core commands will be available

cron.php 1 location

@@ 99-112 (lines=14) @@
96
97
	if (OC::$CLI) {
98
		// the cron job must be executed with the right user
99
		if (!OC_Util::runningOnWindows())  {
100
			if (!function_exists('posix_getuid')) {
101
				echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
102
				exit(0);
103
			}
104
			$user = posix_getpwuid(posix_getuid());
105
			$configUser = posix_getpwuid(fileowner(OC::$SERVERROOT . '/config/config.php'));
106
			if ($user['name'] !== $configUser['name']) {
107
				echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL;
108
				echo "Current user: " . $user['name'] . PHP_EOL;
109
				echo "Web server user: " . $configUser['name'] . PHP_EOL;
110
				exit(0);
111
			}
112
		}
113
114
		// Create lock file first
115
		TemporaryCronClass::$lockfile = OC_Config::getValue("datadirectory", OC::$SERVERROOT . '/data') . '/cron.lock';