summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-07-11 13:16:03 +0200
committerGitHub <noreply@github.com>2016-07-11 13:16:03 +0200
commit0c1cf5f7eb15532901aa3b4f29a4e3ee5fa58467 (patch)
tree1503a3a06e94d9f36b1675a0b4f46284c0f83b23 /lib
parent34c0b9d2c02f787b46dd27af66ab2726d6024636 (diff)
parent6ea77abb38e4b85556ccde8801071f5f10a92ced (diff)
downloadnextcloud-server-0c1cf5f7eb15532901aa3b4f29a4e3ee5fa58467.tar.gz
nextcloud-server-0c1cf5f7eb15532901aa3b4f29a4e3ee5fa58467.zip
Merge pull request #347 from nextcloud/drop-windows-foo
Remove unneeded checks if it runs on a Windows machine
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Storage/Common.php20
-rw-r--r--lib/private/PreviewManager.php8
-rw-r--r--lib/private/Setup.php4
-rw-r--r--lib/private/legacy/helper.php2
-rw-r--r--lib/private/legacy/util.php33
5 files changed, 17 insertions, 50 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 0c1b69108d4..6c4013d2acb 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -489,25 +489,7 @@ abstract class Common implements Storage, ILockingStorage {
}
// NOTE: $path will remain unverified for now
- if (\OC_Util::runningOnWindows()) {
- $this->verifyWindowsPath($fileName);
- } else {
- $this->verifyPosixPath($fileName);
- }
- }
-
- /**
- * https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx
- * @param string $fileName
- * @throws InvalidPathException
- */
- protected function verifyWindowsPath($fileName) {
- $fileName = trim($fileName);
- $this->scanForInvalidCharacters($fileName, "\\/<>:\"|?*");
- $reservedNames = ['CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9'];
- if (in_array(strtoupper($fileName), $reservedNames)) {
- throw new ReservedWordException();
- }
+ $this->verifyPosixPath($fileName);
}
/**
diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php
index f3c7a4de0d0..43c414ccb63 100644
--- a/lib/private/PreviewManager.php
+++ b/lib/private/PreviewManager.php
@@ -299,8 +299,7 @@ class PreviewManager implements IPreview {
}
if (count($checkImagick->queryFormats('PDF')) === 1) {
- // Office previews are currently not supported on Windows
- if (!\OC_Util::runningOnWindows() && \OC_Helper::is_function_enabled('shell_exec')) {
+ if (\OC_Helper::is_function_enabled('shell_exec')) {
$officeFound = is_string($this->config->getSystemValue('preview_libreoffice_path', null));
if (!$officeFound) {
@@ -324,9 +323,8 @@ class PreviewManager implements IPreview {
}
}
- // Video requires avconv or ffmpeg and is therefor
- // currently not supported on Windows.
- if (in_array('OC\Preview\Movie', $this->getEnabledDefaultProvider()) && !\OC_Util::runningOnWindows()) {
+ // Video requires avconv or ffmpeg
+ if (in_array('OC\Preview\Movie', $this->getEnabledDefaultProvider())) {
$avconvBinary = \OC_Helper::findBinaryPath('avconv');
$ffmpegBinary = ($avconvBinary) ? null : \OC_Helper::findBinaryPath('ffmpeg');
diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index 46969f50fa0..f1454805a08 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -305,10 +305,6 @@ class Setup {
$trustedDomains = [$request->getInsecureServerHost()];
}
- if (\OC_Util::runningOnWindows()) {
- $dataDir = rtrim(realpath($dataDir), '\\');
- }
-
//use sqlite3 when available, otherwise sqlite2 will be used.
if($dbType=='sqlite' and class_exists('SQLite3')) {
$dbType='sqlite3';
diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php
index 21fb3cbc5ab..06cffe80837 100644
--- a/lib/private/legacy/helper.php
+++ b/lib/private/legacy/helper.php
@@ -534,7 +534,7 @@ class OC_Helper {
return $memcache->get($program);
}
$result = null;
- if (!\OC_Util::runningOnWindows() && self::is_function_enabled('exec')) {
+ if (self::is_function_enabled('exec')) {
$exeSniffer = new ExecutableFinder();
// Returns null if nothing is found
$result = $exeSniffer->find($program);
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php
index 3c56008a48b..2a876eda4d0 100644
--- a/lib/private/legacy/util.php
+++ b/lib/private/legacy/util.php
@@ -902,22 +902,18 @@ class OC_Util {
public static function checkDataDirectoryPermissions($dataDirectory) {
$l = \OC::$server->getL10N('lib');
$errors = array();
- if (self::runningOnWindows()) {
- //TODO: permissions checks for windows hosts
- } else {
- $permissionsModHint = $l->t('Please change the permissions to 0770 so that the directory'
- . ' cannot be listed by other users.');
+ $permissionsModHint = $l->t('Please change the permissions to 0770 so that the directory'
+ . ' cannot be listed by other users.');
+ $perms = substr(decoct(@fileperms($dataDirectory)), -3);
+ if (substr($perms, -1) != '0') {
+ chmod($dataDirectory, 0770);
+ clearstatcache();
$perms = substr(decoct(@fileperms($dataDirectory)), -3);
- if (substr($perms, -1) != '0') {
- chmod($dataDirectory, 0770);
- clearstatcache();
- $perms = substr(decoct(@fileperms($dataDirectory)), -3);
- if (substr($perms, 2, 1) != '0') {
- $errors[] = array(
- 'error' => $l->t('Data directory (%s) is readable by other users', array($dataDirectory)),
- 'hint' => $permissionsModHint
- );
- }
+ if (substr($perms, 2, 1) != '0') {
+ $errors[] = array(
+ 'error' => $l->t('Data directory (%s) is readable by other users', array($dataDirectory)),
+ 'hint' => $permissionsModHint
+ );
}
}
return $errors;
@@ -933,7 +929,7 @@ class OC_Util {
public static function checkDataDirectoryValidity($dataDirectory) {
$l = \OC::$server->getL10N('lib');
$errors = [];
- if (!self::runningOnWindows() && $dataDirectory[0] !== '/') {
+ if ($dataDirectory[0] !== '/') {
$errors[] = [
'error' => $l->t('Data directory (%s) must be an absolute path', [$dataDirectory]),
'hint' => $l->t('Check the value of "datadirectory" in your configuration')
@@ -1203,11 +1199,6 @@ class OC_Util {
* @return bool
*/
public static function isSetLocaleWorking() {
- // setlocale test is pointless on Windows
- if (OC_Util::runningOnWindows()) {
- return true;
- }
-
\Patchwork\Utf8\Bootup::initLocale();
if ('' === basename('ยง')) {
return false;