summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-27 23:27:21 +0000
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-27 23:29:46 +0000
commit1511a42da78bc4fbc2c202112bf10d249e3dc92f (patch)
treef4d0114442ad9167b1533f9cbf103f223ef4e4a6 /lib
parentd55b88c043adcd40c51999a26b47d39cc8e1a183 (diff)
downloadnextcloud-server-1511a42da78bc4fbc2c202112bf10d249e3dc92f.tar.gz
nextcloud-server-1511a42da78bc4fbc2c202112bf10d249e3dc92f.zip
Check for relative datadirectory path
Diffstat (limited to 'lib')
-rw-r--r--lib/private/util.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/private/util.php b/lib/private/util.php
index a0ef491d9db..5aa65401b9a 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -886,17 +886,23 @@ class OC_Util {
* checking the existence of the ".ocdata" file.
*
* @param string $dataDirectory data directory path
- * @return bool true if the data directory is valid, false otherwise
+ * @return array errors found
*/
public static function checkDataDirectoryValidity($dataDirectory) {
$l = \OC::$server->getL10N('lib');
- $errors = array();
+ $errors = [];
+ if (!self::runningOnWindows() && $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')
+ ];
+ }
if (!file_exists($dataDirectory . '/.ocdata')) {
- $errors[] = array(
- 'error' => $l->t('Data directory (%s) is invalid', array($dataDirectory)),
+ $errors[] = [
+ 'error' => $l->t('Data directory (%s) is invalid', [$dataDirectory]),
'hint' => $l->t('Please check that the data directory contains a file' .
' ".ocdata" in its root.')
- );
+ ];
}
return $errors;
}