|
|
|
|
@ -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; |
|
|
|
|
|