Make getShareFolder use given view instead of static FS
This commit is contained in:
parent
cc532bb14a
commit
a636078e6c
|
@ -277,19 +277,23 @@ class Helper {
|
||||||
/**
|
/**
|
||||||
* get default share folder
|
* get default share folder
|
||||||
*
|
*
|
||||||
|
* @param \OC\Files\View
|
||||||
* @return string
|
* @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 = \OC::$server->getConfig()->getSystemValue('share_folder', '/');
|
||||||
$shareFolder = Filesystem::normalizePath($shareFolder);
|
$shareFolder = Filesystem::normalizePath($shareFolder);
|
||||||
|
|
||||||
if (!Filesystem::file_exists($shareFolder)) {
|
if (!$view->file_exists($shareFolder)) {
|
||||||
$dir = '';
|
$dir = '';
|
||||||
$subdirs = explode('/', $shareFolder);
|
$subdirs = explode('/', $shareFolder);
|
||||||
foreach ($subdirs as $subdir) {
|
foreach ($subdirs as $subdir) {
|
||||||
$dir = $dir . '/' . $subdir;
|
$dir = $dir . '/' . $subdir;
|
||||||
if (!Filesystem::is_dir($dir)) {
|
if (!$view->is_dir($dir)) {
|
||||||
Filesystem::mkdir($dir);
|
$view->mkdir($dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class SharedMount extends MountPoint implements MoveableMount {
|
||||||
$parent = dirname($share->getTarget());
|
$parent = dirname($share->getTarget());
|
||||||
|
|
||||||
if (!$this->recipientView->is_dir($parent)) {
|
if (!$this->recipientView->is_dir($parent)) {
|
||||||
$parent = Helper::getShareFolder();
|
$parent = Helper::getShareFolder($this->recipientView);
|
||||||
}
|
}
|
||||||
|
|
||||||
$newMountPoint = $this->generateUniqueTarget(
|
$newMountPoint = $this->generateUniqueTarget(
|
||||||
|
|
Loading…
Reference in New Issue