]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make getShareFolder use given view instead of static FS
authorVincent Petry <pvince81@owncloud.com>
Fri, 17 Jun 2016 09:11:59 +0000 (11:11 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 17 Jun 2016 09:11:59 +0000 (11:11 +0200)
apps/files_sharing/lib/Helper.php
apps/files_sharing/lib/SharedMount.php

index e4640f82eb6c70c426b981b0aac635113d59d72f..2353a281b7e24eec98f4ff8ff2558970409f5762 100644 (file)
@@ -277,19 +277,23 @@ class Helper {
        /**
         * get default share folder
         *
+        * @param \OC\Files\View
         * @return string
         */
-       public static function getShareFolder() {
+       public static function getShareFolder($view = null) {
+               if ($view === null) {
+                       $view = Filesystem::getView();
+               }
                $shareFolder = \OC::$server->getConfig()->getSystemValue('share_folder', '/');
                $shareFolder = Filesystem::normalizePath($shareFolder);
 
-               if (!Filesystem::file_exists($shareFolder)) {
+               if (!$view->file_exists($shareFolder)) {
                        $dir = '';
                        $subdirs = explode('/', $shareFolder);
                        foreach ($subdirs as $subdir) {
                                $dir = $dir . '/' . $subdir;
-                               if (!Filesystem::is_dir($dir)) {
-                                       Filesystem::mkdir($dir);
+                               if (!$view->is_dir($dir)) {
+                                       $view->mkdir($dir);
                                }
                        }
                }
index 83527053f435212c1ceff7233f91ec876462aac4..2b066bd2d944d917a586fb7d6ad0d936208e8e00 100644 (file)
@@ -81,7 +81,7 @@ class SharedMount extends MountPoint implements MoveableMount {
                $parent = dirname($share->getTarget());
 
                if (!$this->recipientView->is_dir($parent)) {
-                       $parent = Helper::getShareFolder();
+                       $parent = Helper::getShareFolder($this->recipientView);
                }
 
                $newMountPoint = $this->generateUniqueTarget(