Commit 7fc4642a authored by RealRancor's avatar RealRancor
Browse files

Remove checks whether OC is running on Windows pt. 2

parent e4e0e27e
......@@ -41,6 +41,13 @@ if (version_compare(PHP_VERSION, '5.6.0') === -1) {
return;
}
// running oC on Windows is unsupported since 8.1, this has to happen here because
// is seems that the autoloader on Windows fails later and just throws an exception.
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
echo 'ownCloud Server does not support Microsoft Windows.';
return;
}
function exceptionHandler($exception) {
echo "An unhandled exception has been thrown:" . PHP_EOL;
echo $exception;
......@@ -59,20 +66,18 @@ try {
set_exception_handler('exceptionHandler');
if (!OC_Util::runningOnWindows()) {
if (!function_exists('posix_getuid')) {
echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
exit(1);
}
$user = posix_getpwuid(posix_getuid());
$configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php'));
if ($user['name'] !== $configUser['name']) {
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
echo "Current user: " . $user['name'] . PHP_EOL;
echo "Owner of config.php: " . $configUser['name'] . PHP_EOL;
echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL;
exit(1);
}
if (!function_exists('posix_getuid')) {
echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
exit(1);
}
$user = posix_getpwuid(posix_getuid());
$configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php'));
if ($user['name'] !== $configUser['name']) {
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
echo "Current user: " . $user['name'] . PHP_EOL;
echo "Owner of config.php: " . $configUser['name'] . PHP_EOL;
echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL;
exit(1);
}
$oldWorkingDir = getcwd();
......
......@@ -84,19 +84,17 @@ try {
set_time_limit(0);
// the cron job must be executed with the right user
if (!OC_Util::runningOnWindows()) {
if (!function_exists('posix_getuid')) {
echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
exit(0);
}
$user = posix_getpwuid(posix_getuid());
$configUser = posix_getpwuid(fileowner(OC::$SERVERROOT . '/config/config.php'));
if ($user['name'] !== $configUser['name']) {
echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL;
echo "Current user: " . $user['name'] . PHP_EOL;
echo "Web server user: " . $configUser['name'] . PHP_EOL;
exit(0);
}
if (!function_exists('posix_getuid')) {
echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
exit(0);
}
$user = posix_getpwuid(posix_getuid());
$configUser = posix_getpwuid(fileowner(OC::$SERVERROOT . '/config/config.php'));
if ($user['name'] !== $configUser['name']) {
echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL;
echo "Current user: " . $user['name'] . PHP_EOL;
echo "Web server user: " . $configUser['name'] . PHP_EOL;
exit(0);
}
// We call ownCloud from the CLI (aka cron)
......
......@@ -253,16 +253,9 @@ class OC_Helper {
if ($path === false) {
$path = getenv("PATH");
}
// check method depends on operating system
if (!strncmp(PHP_OS, "WIN", 3)) {
// on Windows an appropriate COM or EXE file needs to exist
$exts = [".exe", ".com"];
$check_fn = "file_exists";
} else {
// anywhere else we look for an executable file of that name
$exts = [""];
$check_fn = "is_executable";
}
// we look for an executable file of that name
$exts = [""];
$check_fn = "is_executable";
// Default check will be done with $path directories :
$dirs = explode(PATH_SEPARATOR, $path);
// WARNING : We have to check if open_basedir is enabled :
......@@ -523,7 +516,6 @@ class OC_Helper {
/**
* Try to find a program
* Note: currently windows is not supported
*
* @param string $program
* @return null|string
......
......@@ -647,21 +647,6 @@ class OC_Util {
$webServerRestart = true;
}
// Check if server running on Windows platform
if(OC_Util::runningOnWindows()) {
$errors[] = [
'error' => $l->t('Microsoft Windows Platform is not supported'),
'hint' => $l->t('Running ownCloud Server on the Microsoft Windows platform is not supported. We suggest you ' .
'use a Linux server in a virtual machine if you have no option for migrating the server itself. ' .
'Find Linux packages as well as easy to deploy virtual machine images on <a href="%s">%s</a>. ' .
'For migrating existing installations to Linux you can find some tips and a migration script ' .
'in <a href="%s">our documentation</a>.',
['https://owncloud.org/install/', 'owncloud.org/install/', 'https://owncloud.org/?p=8045'])
];
// don't bother with further checks
return $errors;
}
// Check if config folder is writable.
if(!OC_Helper::isReadOnlyConfigEnabled()) {
if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
......@@ -1248,15 +1233,6 @@ class OC_Util {
}
}
/**
* Checks whether the server is running on Windows
*
* @return bool true if running on Windows, false otherwise
*/
public static function runningOnWindows() {
return (substr(PHP_OS, 0, 3) === "WIN");
}
/**
* Checks whether the server is running on Mac OS X
*
......
......@@ -149,9 +149,6 @@ $template->assign('cronErrors', $config->getAppValue('core', 'cronErrors'));
$path = getenv('PATH');
$template->assign('getenvServerNotWorking', empty($path));
// warn if Windows is used
$template->assign('WindowsWarning', OC_Util::runningOnWindows());
// warn if outdated version of a memcache module is used
$caches = [
'apcu' => ['name' => $l->t('APCu'), 'version' => '4.0.6'],
......
......@@ -106,15 +106,6 @@ if ($_['invalidTransactionIsolationLevel']) {
<?php
}
// Windows Warning
if ($_['WindowsWarning']) {
?>
<li>
<?php p($l->t('Your server is running on Microsoft Windows. We highly recommend Linux for optimal user experience.')); ?>
</li>
<?php
}
// Warning if memcache is outdated
foreach ($_['OutdatedCacheWarning'] as $php_module => $data) {
?>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment