Make getShareFolder use given view instead of static FS (#25150)

This commit is contained in:
Vincent Petry 2016-06-20 12:02:04 +02:00 committed by Lukas Reschke
parent cf3b5e3e86
commit f11e486025
No known key found for this signature in database
GPG Key ID: 9AB0ADB949B6898C
2 changed files with 9 additions and 5 deletions

View File

@ -302,19 +302,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);
}
}
}

View File

@ -75,7 +75,7 @@ class SharedMount extends MountPoint implements MoveableMount {
$parent = dirname($share['file_target']);
if (!$this->recipientView->is_dir($parent)) {
$parent = Helper::getShareFolder();
$parent = Helper::getShareFolder($this->recipientView);
}
$newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget(