diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-09-18 14:15:52 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-09-30 10:24:52 +0200 |
commit | 83a06950f4e0175f2073bc23820d88eb63dad642 (patch) | |
tree | 90a2cca3f7f4769dd8fdfd32341358b0f3919111 | |
parent | 6c09c0e0821379fef9571be12e8f72367ffc426a (diff) | |
download | nextcloud-server-83a06950f4e0175f2073bc23820d88eb63dad642.tar.gz nextcloud-server-83a06950f4e0175f2073bc23820d88eb63dad642.zip |
Check for writable datadir during setup
-rw-r--r-- | lib/private/setup.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/private/setup.php b/lib/private/setup.php index d79f6b4765e..274792297d9 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -37,18 +37,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']; |