summaryrefslogtreecommitdiffstats
path: root/lib/private/setup.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-09-18 14:15:52 +0200
committerRobin Appelman <icewind@owncloud.com>2014-09-18 14:15:52 +0200
commitc8dbdc29d028a56a9fb55ae3737434495f3e0eab (patch)
tree4ab1ba4af8bfafd8fff64c434f35b7146a7500d5 /lib/private/setup.php
parent23dd7cb51d392d2d6fb82b55c5f51a6bf6e93733 (diff)
downloadnextcloud-server-c8dbdc29d028a56a9fb55ae3737434495f3e0eab.tar.gz
nextcloud-server-c8dbdc29d028a56a9fb55ae3737434495f3e0eab.zip
Check for writable datadir during setup
Diffstat (limited to 'lib/private/setup.php')
-rw-r--r--lib/private/setup.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/private/setup.php b/lib/private/setup.php
index 95e908d10ec..fa1f5699511 100644
--- a/lib/private/setup.php
+++ b/lib/private/setup.php
@@ -38,18 +38,28 @@ class OC_Setup {
$dbtype = 'sqlite';
}
+ $username = htmlspecialchars_decode($options['adminlogin']);
+ $password = htmlspecialchars_decode($options['adminpass']);
+ $datadir = htmlspecialchars_decode($options['directory']);
+
$class = self::$dbSetupClasses[$dbtype];
+ /** @var \OC\Setup\AbstractDatabase $dbSetup */
$dbSetup = new $class(self::getTrans(), 'db_structure.xml');
$error = array_merge($error, $dbSetup->validate($options));
+ // validate the data directory
+ if (
+ (!is_dir($datadir) and !mkdir($datadir)) or
+ !is_writable($datadir)
+ ) {
+ $error[] = $l->t("Can't create or write into the data directory %s", array($datadir));
+ }
+
if(count($error) != 0) {
return $error;
}
//no errors, good
- $username = htmlspecialchars_decode($options['adminlogin']);
- $password = htmlspecialchars_decode($options['adminpass']);
- $datadir = htmlspecialchars_decode($options['directory']);
if( isset($options['trusted_domains'])
&& is_array($options['trusted_domains'])) {
$trustedDomains = $options['trusted_domains'];