本文整理汇总了PHP中OCA\Files_Sharing\Helper::getUidAndFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::getUidAndFilename方法的具体用法?PHP Helper::getUidAndFilename怎么用?PHP Helper::getUidAndFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCA\Files_Sharing\Helper
的用法示例。
在下文中一共展示了Helper::getUidAndFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rename
public function rename($path1, $path2)
{
// we need the paths relative to data/user/files
$relPath1 = $this->getMountPoint() . '/' . $path1;
$relPath2 = $this->getMountPoint() . '/' . $path2;
// check for update permissions on the share
if ($this->isUpdatable('')) {
$pathinfo = pathinfo($relPath1);
// for part files we need to ask for the owner and path from the parent directory because
// the file cache doesn't return any results for part files
if ($pathinfo['extension'] === 'part') {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($pathinfo['dirname']);
$path1 = $path1 . '/' . $pathinfo['basename'];
} else {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($relPath1);
}
$targetFilename = basename($relPath2);
list($user2, $path2) = \OCA\Files_Sharing\Helper::getUidAndFilename(dirname($relPath2));
$rootView = new \OC\Files\View('');
return $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename);
}
return false;
}
示例2: rename
public function rename($path1, $path2)
{
// we need the paths relative to data/user/files
$relPath1 = $this->getMountPoint() . '/' . $path1;
$relPath2 = $this->getMountPoint() . '/' . $path2;
$pathinfo = pathinfo($relPath1);
$isPartFile = isset($pathinfo['extension']) && $pathinfo['extension'] === 'part';
$targetExists = $this->file_exists($path2);
$sameFolder = dirname($relPath1) === dirname($relPath2);
if ($targetExists || $sameFolder && !$isPartFile) {
// note that renaming a share mount point is always allowed
if (!$this->isUpdatable('')) {
return false;
}
} else {
if (!$this->isCreatable('')) {
return false;
}
}
// for part files we need to ask for the owner and path from the parent directory because
// the file cache doesn't return any results for part files
if ($isPartFile) {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($pathinfo['dirname']);
$path1 = $path1 . '/' . $pathinfo['basename'];
} else {
list($user1, $path1) = \OCA\Files_Sharing\Helper::getUidAndFilename($relPath1);
}
$targetFilename = basename($relPath2);
list($user2, $path2) = \OCA\Files_Sharing\Helper::getUidAndFilename(dirname($relPath2));
$rootView = new \OC\Files\View('');
return $rootView->rename('/' . $user1 . '/files/' . $path1, '/' . $user2 . '/files/' . $path2 . '/' . $targetFilename);
}