]> source.dussan.org Git - nextcloud-server.git/commitdiff
Store the global mount configuration file in the datadir
authorRobin Appelman <icewind@owncloud.com>
Sun, 10 Mar 2013 01:25:03 +0000 (02:25 +0100)
committerRobin Appelman <icewind@owncloud.com>
Sun, 10 Mar 2013 01:25:03 +0000 (02:25 +0100)
apps/files_external/lib/config.php
lib/files/filesystem.php

index 430269e03d9061f82bc98fa92ae6823251a33cf8..11d24045fd9012fc76dbd53e5bff837c61b5b780 100755 (executable)
@@ -307,8 +307,9 @@ class OC_Mount_Config {
                        $phpFile = OC_User::getHome(OCP\User::getUser()).'/mount.php';
                        $jsonFile = OC_User::getHome(OCP\User::getUser()).'/mount.json';
                } else {
+                       $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
                        $phpFile = OC::$SERVERROOT.'/config/mount.php';
-                       $jsonFile = OC::$SERVERROOT.'/config/mount.json';
+                       $jsonFile = $datadir . '/mount.json';
                }
                if (is_file($jsonFile)) {
                        $mountPoints = json_decode(file_get_contents($jsonFile), true);
@@ -333,7 +334,8 @@ class OC_Mount_Config {
                if ($isPersonal) {
                        $file = OC_User::getHome(OCP\User::getUser()).'/mount.json';
                } else {
-                       $file = OC::$SERVERROOT.'/config/mount.json';
+                       $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
+                       $file = $datadir . '/mount.json';
                }
                $content = json_encode($data);
                @file_put_contents($file, $content);
index 0bbd7550d74dce4638cc3f5e74f559f59f680513..40fef674a006f9c0a982e3c1e155a607df8d0ac8 100644 (file)
@@ -221,11 +221,16 @@ class Filesystem {
 
                $root = \OC_User::getHome($user);
                self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user);
+               $datadir = \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data");
 
+               //move config file to it's new position
+               if (is_file(\OC::$SERVERROOT . '/config/mount.json')) {
+                       rename(\OC::$SERVERROOT . '/config/mount.json', $datadir . '/mount.json');
+               }
                // Load system mount points
-               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);
+               if (is_file(\OC::$SERVERROOT . '/config/mount.php') or is_file($datadir . '/mount.json')) {
+                       if (is_file($datadir . '/mount.json')) {
+                               $mountConfig = json_decode(file_get_contents($datadir . '/mount.json'), true);
                        } elseif (is_file(\OC::$SERVERROOT . '/config/mount.php')) {
                                $mountConfig = $parser->parsePHP(file_get_contents(\OC::$SERVERROOT . '/config/mount.php'));
                        }