|
|
|
|
|
|
|
|
* @return string |
|
|
* @return string |
|
|
*/ |
|
|
*/ |
|
|
public function generateTarget($filePath, $shareWith, $exclude = null) { |
|
|
public function generateTarget($filePath, $shareWith, $exclude = null) { |
|
|
$target = '/'.basename($filePath); |
|
|
|
|
|
|
|
|
$shareFolder = \OCA\Files_Sharing\Helper::getShareFolder(); |
|
|
|
|
|
$target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($filePath)); |
|
|
|
|
|
|
|
|
// for group shares we return the target right away |
|
|
// for group shares we return the target right away |
|
|
if ($shareWith === false) { |
|
|
if ($shareWith === false) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\OC\Files\Filesystem::initMountPoints($shareWith); |
|
|
\OC\Files\Filesystem::initMountPoints($shareWith); |
|
|
$view = new \OC\Files\View('/' . $shareWith . '/files'); |
|
|
$view = new \OC\Files\View('/' . $shareWith . '/files'); |
|
|
|
|
|
|
|
|
|
|
|
if (!$view->is_dir($shareFolder)) { |
|
|
|
|
|
$dir = ''; |
|
|
|
|
|
$subdirs = explode('/', $shareFolder); |
|
|
|
|
|
foreach ($subdirs as $subdir) { |
|
|
|
|
|
$dir = $dir . '/' . $subdir; |
|
|
|
|
|
if (!$view->is_dir($dir)) { |
|
|
|
|
|
$view->mkdir($dir); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$excludeList = \OCP\Share::getItemsSharedWithUser('file', $shareWith, self::FORMAT_TARGET_NAMES); |
|
|
$excludeList = \OCP\Share::getItemsSharedWithUser('file', $shareWith, self::FORMAT_TARGET_NAMES); |
|
|
if (is_array($exclude)) { |
|
|
if (is_array($exclude)) { |
|
|
$excludeList = array_merge($excludeList, $exclude); |
|
|
$excludeList = array_merge($excludeList, $exclude); |