summaryrefslogtreecommitdiffstats
path: root/lib/files
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-02-18 14:56:25 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2013-02-18 14:56:25 -0800
commitd9035d4fdc6b5363c1a5b96a8ba8b6f387a0eafb (patch)
tree6b130dc252b7b48800c64a681d6aea13e40e4a2d /lib/files
parent474b82931b44af08642403ac06f22b4ecfc056b1 (diff)
parent3bf9aa408e4fb3f20dc715ad43b7a6aaaa6fb4f4 (diff)
downloadnextcloud-server-d9035d4fdc6b5363c1a5b96a8ba8b6f387a0eafb.tar.gz
nextcloud-server-d9035d4fdc6b5363c1a5b96a8ba8b6f387a0eafb.zip
Merge pull request #1728 from owncloud/mountconfig
Use json for new mount configuration files
Diffstat (limited to 'lib/files')
-rw-r--r--lib/files/filesystem.php28
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php
index f4530868077..cba469e06c4 100644
--- a/lib/files/filesystem.php
+++ b/lib/files/filesystem.php
@@ -215,9 +215,15 @@ class Filesystem {
if ($user == '') {
$user = \OC_User::getUser();
}
+ $parser = new \OC\ArrayParser();
+
// Load system mount points
- if (is_file(\OC::$SERVERROOT . '/config/mount.php')) {
- $mountConfig = include 'config/mount.php';
+ if (is_file(\OC::$SERVERROOT . '/config/mount.php') or is_file(\OC::$SERVERROOT . '/config/mount.json')) {
+ if(is_file(\OC::$SERVERROOT . '/config/mount.json')){
+ $mountConfig = json_decode(file_get_contents(\OC::$SERVERROOT . '/config/mount.json'), true);
+ }elseif(is_file(\OC::$SERVERROOT . '/config/mount.php')){
+ $mountConfig = $parser->parsePHP(file_get_contents(\OC::$SERVERROOT . '/config/mount.php'));
+ }
if (isset($mountConfig['global'])) {
foreach ($mountConfig['global'] as $mountPoint => $options) {
self::mount($options['class'], $options['options'], $mountPoint);
@@ -253,8 +259,12 @@ class Filesystem {
// Load personal mount points
$root = \OC_User::getHome($user);
self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);
- if (is_file($root . '/mount.php')) {
- $mountConfig = include $root . '/mount.php';
+ if (is_file($root . '/mount.php') or is_file($root . '/mount.json')) {
+ if (is_file($root . '/mount.json')){
+ $mountConfig = json_decode(file_get_contents($root . '/mount.json'), true);
+ } elseif (is_file($root . '/mount.php')){
+ $mountConfig = $parser->parsePHP(file_get_contents($root . '/mount.php'));
+ }
if (isset($mountConfig['user'][$user])) {
foreach ($mountConfig['user'][$user] as $mountPoint => $options) {
self::mount($options['class'], $options['options'], $mountPoint);
@@ -613,11 +623,11 @@ class Filesystem {
}
/**
- * Get the owner for a file or folder
- *
- * @param string $path
- * @return string
- */
+ * Get the owner for a file or folder
+ *
+ * @param string $path
+ * @return string
+ */
public static function getOwner($path) {
return self::$defaultInstance->getOwner($path);
}