當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Helper::getUidAndFilename方法代碼示例

本文整理匯總了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;
 }
開發者ID:ArcherSys,項目名稱:ArcherSysOSCloud7,代碼行數:23,代碼來源:sharedstorage.php

示例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);
 }
開發者ID:kebenxiaoming,項目名稱:owncloudRedis,代碼行數:32,代碼來源:sharedstorage.php


注:本文中的OCA\Files_Sharing\Helper::getUidAndFilename方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。