Merge pull request #4210 from nextcloud/downstream-26643

Removed path to datadir in exception
This commit is contained in:
Roeland Jago Douma 2017-04-10 12:43:46 +02:00 committed by GitHub
commit afea05d296
1 changed files with 15 additions and 15 deletions

View File

@ -698,22 +698,22 @@ class OC_Util {
if ($success) { if ($success) {
$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY)); $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
} else { } else {
$errors[] = array( $errors[] = [
'error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)), 'error' => $l->t('Cannot create "data" directory'),
'hint' => $l->t('This can usually be fixed by ' 'hint' => $l->t('This can usually be fixed by '
. '<a href="%s" target="_blank" rel="noreferrer">giving the webserver write access to the root directory</a>.', . '<a href="%s" target="_blank" rel="noreferrer">giving the webserver write access to the root directory</a>.',
array($urlGenerator->linkToDocs('admin-dir_permissions'))) [$urlGenerator->linkToDocs('admin-dir_permissions')])
); ];
} }
} else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { } else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
//common hint for all file permissions error messages //common hint for all file permissions error messages
$permissionsHint = $l->t('Permissions can usually be fixed by ' $permissionsHint = $l->t('Permissions can usually be fixed by '
. '%sgiving the webserver write access to the root directory%s.', . '%sgiving the webserver write access to the root directory%s.',
array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>')); ['<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>']);
$errors[] = array( $errors[] = [
'error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable', 'error' => 'Your data directory is not writable',
'hint' => $permissionsHint 'hint' => $permissionsHint
); ];
} else { } else {
$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY)); $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
} }
@ -923,15 +923,15 @@ class OC_Util {
$permissionsModHint = $l->t('Please change the permissions to 0770 so that the directory' $permissionsModHint = $l->t('Please change the permissions to 0770 so that the directory'
. ' cannot be listed by other users.'); . ' cannot be listed by other users.');
$perms = substr(decoct(@fileperms($dataDirectory)), -3); $perms = substr(decoct(@fileperms($dataDirectory)), -3);
if (substr($perms, -1) != '0') { if (substr($perms, -1) !== '0') {
chmod($dataDirectory, 0770); chmod($dataDirectory, 0770);
clearstatcache(); clearstatcache();
$perms = substr(decoct(@fileperms($dataDirectory)), -3); $perms = substr(decoct(@fileperms($dataDirectory)), -3);
if (substr($perms, 2, 1) != '0') { if ($perms[2] !== '0') {
$errors[] = array( $errors[] = [
'error' => $l->t('Data directory (%s) is readable by other users', array($dataDirectory)), 'error' => $l->t('Your data directory is readable by other users'),
'hint' => $permissionsModHint 'hint' => $permissionsModHint
); ];
} }
} }
return $errors; return $errors;
@ -949,13 +949,13 @@ class OC_Util {
$errors = []; $errors = [];
if ($dataDirectory[0] !== '/') { if ($dataDirectory[0] !== '/') {
$errors[] = [ $errors[] = [
'error' => $l->t('Data directory (%s) must be an absolute path', [$dataDirectory]), 'error' => $l->t('Your data directory must be an absolute path'),
'hint' => $l->t('Check the value of "datadirectory" in your configuration') 'hint' => $l->t('Check the value of "datadirectory" in your configuration')
]; ];
} }
if (!file_exists($dataDirectory . '/.ocdata')) { if (!file_exists($dataDirectory . '/.ocdata')) {
$errors[] = [ $errors[] = [
'error' => $l->t('Data directory (%s) is invalid', [$dataDirectory]), 'error' => $l->t('Your data directory is invalid'),
'hint' => $l->t('Please check that the data directory contains a file' . 'hint' => $l->t('Please check that the data directory contains a file' .
' ".ocdata" in its root.') ' ".ocdata" in its root.')
]; ];