From bee0a3699e9f42a1ff89585bfbee5ad43f04d129 Mon Sep 17 00:00:00 2001 From: Kawohl Date: Tue, 15 Nov 2016 11:41:33 +0100 Subject: [PATCH 1/2] removed path to datadir Signed-off-by: Morris Jobke --- lib/private/legacy/util.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index 0672fefbe0..9bfadbbd8b 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -698,22 +698,22 @@ class OC_Util { if ($success) { $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY)); } else { - $errors[] = array( - 'error' => $l->t('Cannot create "data" directory (%s)', array($CONFIG_DATADIRECTORY)), + $errors[] = [ + 'error' => $l->t('Cannot create "data" directory'), 'hint' => $l->t('This can usually be fixed by ' . 'giving the webserver write access to the root directory.', - array($urlGenerator->linkToDocs('admin-dir_permissions'))) - ); + [$urlGenerator->linkToDocs('admin-dir_permissions')]) + ]; } } else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { //common hint for all file permissions error messages $permissionsHint = $l->t('Permissions can usually be fixed by ' . '%sgiving the webserver write access to the root directory%s.', - array('', '')); - $errors[] = array( - 'error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable', + ['', '']); + $errors[] = [ + 'error' => 'Your Data directory is not writable', 'hint' => $permissionsHint - ); + ]; } else { $errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY)); } @@ -928,10 +928,10 @@ class OC_Util { 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)), + $errors[] = [ + 'error' => $l->t('Your Data directory is readable by other users'), 'hint' => $permissionsModHint - ); + ]; } } return $errors; @@ -949,13 +949,13 @@ class OC_Util { $errors = []; if ($dataDirectory[0] !== '/') { $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') ]; } if (!file_exists($dataDirectory . '/.ocdata')) { $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' . ' ".ocdata" in its root.') ]; From 9e3a3eebf965d0ce4f4a5d377b66d4e14bdd760f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Apr 2017 11:13:46 +0200 Subject: [PATCH 2/2] Lowercase "data" correctly Signed-off-by: Joas Schilling --- lib/private/legacy/util.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index 9bfadbbd8b..0fdd6714b1 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -711,7 +711,7 @@ class OC_Util { . '%sgiving the webserver write access to the root directory%s.', ['', '']); $errors[] = [ - 'error' => 'Your Data directory is not writable', + 'error' => 'Your data directory is not writable', 'hint' => $permissionsHint ]; } else { @@ -923,13 +923,13 @@ class OC_Util { $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') { + if (substr($perms, -1) !== '0') { chmod($dataDirectory, 0770); clearstatcache(); $perms = substr(decoct(@fileperms($dataDirectory)), -3); - if (substr($perms, 2, 1) != '0') { + if ($perms[2] !== '0') { $errors[] = [ - 'error' => $l->t('Your Data directory is readable by other users'), + 'error' => $l->t('Your data directory is readable by other users'), 'hint' => $permissionsModHint ]; } @@ -949,13 +949,13 @@ class OC_Util { $errors = []; if ($dataDirectory[0] !== '/') { $errors[] = [ - 'error' => $l->t('Your Data directory must be an absolute path'), + 'error' => $l->t('Your data directory must be an absolute path'), 'hint' => $l->t('Check the value of "datadirectory" in your configuration') ]; } if (!file_exists($dataDirectory . '/.ocdata')) { $errors[] = [ - 'error' => $l->t('Your Data directory is invalid'), + 'error' => $l->t('Your data directory is invalid'), 'hint' => $l->t('Please check that the data directory contains a file' . ' ".ocdata" in its root.') ];