当前位置: 首页>>代码示例>>PHP>>正文


PHP Filesystem::resolvePath方法代码示例

本文整理汇总了PHP中OC\Files\Filesystem::resolvePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::resolvePath方法的具体用法?PHP Filesystem::resolvePath怎么用?PHP Filesystem::resolvePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC\Files\Filesystem的用法示例。


在下文中一共展示了Filesystem::resolvePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNodeForPath

 /**
  * Returns the INode object for the requested path
  *
  * @param string $path
  * @throws \Sabre_DAV_Exception_NotFound
  * @return \Sabre_DAV_INode
  */
 public function getNodeForPath($path)
 {
     $path = trim($path, '/');
     if (isset($this->cache[$path])) {
         return $this->cache[$path];
     }
     // Is it the root node?
     if (!strlen($path)) {
         return $this->rootNode;
     }
     if (pathinfo($path, PATHINFO_EXTENSION) === 'part') {
         // read from storage
         $absPath = $this->getFileView()->getAbsolutePath($path);
         list($storage, $internalPath) = Filesystem::resolvePath('/' . $absPath);
         if ($storage) {
             $scanner = $storage->getScanner($internalPath);
             // get data directly
             $info = $scanner->getData($internalPath);
         }
     } else {
         // read from cache
         $info = $this->getFileView()->getFileInfo($path);
     }
     if (!$info) {
         throw new \Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
     }
     if ($info['mimetype'] === 'httpd/unix-directory') {
         $node = new \OC_Connector_Sabre_Directory($path);
     } else {
         $node = new \OC_Connector_Sabre_File($path);
     }
     $node->setFileinfoCache($info);
     $this->cache[$path] = $node;
     return $node;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:42,代码来源:objecttree.php

示例2: isExcludedPath

 /**
  * check if path is excluded from encryption
  *
  * @param string $path relative to data/
  * @return boolean
  */
 protected function isExcludedPath($path)
 {
     $view = new \OC\Files\View();
     $normalizedPath = \OC\Files\Filesystem::normalizePath($path);
     $parts = explode('/', $normalizedPath);
     // we only encrypt/decrypt files in the files and files_versions folder
     if (sizeof($parts) < 3) {
         /**
          * Less then 3 parts means, we can't match:
          * - /{$uid}/files/* nor
          * - /{$uid}/files_versions/*
          * So this is not a path we are looking for.
          */
         return true;
     }
     if (!($parts[2] === 'files' && \OCP\User::userExists($parts[1])) && !($parts[2] === 'files_versions' && \OCP\User::userExists($parts[1]))) {
         return true;
     }
     if (!$view->file_exists($normalizedPath)) {
         $normalizedPath = dirname($normalizedPath);
     }
     // we don't encrypt server-to-server shares
     list($storage, ) = \OC\Files\Filesystem::resolvePath($normalizedPath);
     /**
      * @var \OCP\Files\Storage $storage
      */
     if ($storage->instanceOfStorage('OCA\\Files_Sharing\\External\\Storage')) {
         return true;
     }
     return false;
 }
开发者ID:samj1912,项目名称:repo,代码行数:37,代码来源:proxy.php

示例3: propagateChange

 /**
  * @param string $internalPath
  * @param int $time
  * @return array[] all propagated entries
  */
 public function propagateChange($internalPath, $time)
 {
     $source = $this->storage->getSourcePath($internalPath);
     /** @var \OC\Files\Storage\Storage $storage */
     list($storage, $sourceInternalPath) = \OC\Files\Filesystem::resolvePath($source);
     return $storage->getPropagator()->propagateChange($sourceInternalPath, $time);
 }
开发者ID:kenwi,项目名称:core,代码行数:12,代码来源:sharedpropagator.php

示例4: testParentOfMountPointIsGone

 /**
  * if the parent of the mount point is gone then the mount point should move up
  *
  * @medium
  */
 function testParentOfMountPointIsGone()
 {
     // share to user
     $fileinfo = $this->view->getFileInfo($this->folder);
     $result = \OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     $this->assertTrue($result);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
     $this->assertTrue($user2View->file_exists($this->folder));
     // create a local folder
     $result = $user2View->mkdir('localfolder');
     $this->assertTrue($result);
     // move mount point to local folder
     $result = $user2View->rename($this->folder, '/localfolder/' . $this->folder);
     $this->assertTrue($result);
     // mount point in the root folder should no longer exist
     $this->assertFalse($user2View->is_dir($this->folder));
     // delete the local folder
     /** @var \OC\Files\Storage\Storage $storage */
     list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder');
     $storage->rmdir($internalPath);
     //enforce reload of the mount points
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     //mount point should be back at the root
     $this->assertTrue($user2View->is_dir($this->folder));
     //cleanup
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     $this->view->unlink($this->folder);
 }
开发者ID:evanjt,项目名称:core,代码行数:34,代码来源:sharedstorage.php

示例5: getSourceCache

 /**
  * Get the source cache of a shared file or folder
  *
  * @param string $target Shared target file path
  * @return \OC\Files\Cache\Cache
  */
 private function getSourceCache($target)
 {
     if ($target === false || $target === $this->storage->getMountPoint()) {
         $target = '';
     }
     $source = \OC_Share_Backend_File::getSource($target, $this->storage->getMountPoint(), $this->storage->getItemType());
     if (isset($source['path']) && isset($source['fileOwner'])) {
         try {
             \OC\Files\Filesystem::initMountPoints($source['fileOwner']);
         } catch (NoUserException $e) {
             \OC::$server->getLogger()->warning('The user \'' . $source['uid_owner'] . '\' of a share can\'t be retrieved.', array('app' => 'files_sharing'));
             return false;
         }
         $mounts = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
         if (is_array($mounts) and !empty($mounts)) {
             $fullPath = $mounts[0]->getMountPoint() . $source['path'];
             list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($fullPath);
             if ($storage) {
                 $this->files[$target] = $internalPath;
                 $cache = $storage->getCache();
                 $this->storageId = $storage->getId();
                 $this->numericId = $cache->getNumericStorageId();
                 return $cache;
             }
         }
     }
     return false;
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:34,代码来源:cache.php

示例6: getData

 /**
  * Returns metadata from the shared storage, but
  * with permissions from the source storage.
  *
  * @param string $path path of the file for which to retrieve metadata
  *
  * @return array an array of metadata of the file
  */
 protected function getData($path)
 {
     $data = parent::getData($path);
     $sourcePath = $this->storage->getSourcePath($path);
     list($sourceStorage, $internalPath) = \OC\Files\Filesystem::resolvePath($sourcePath);
     $data['permissions'] = $sourceStorage->getPermissions($internalPath);
     return $data;
 }
开发者ID:kenwi,项目名称:core,代码行数:16,代码来源:scanner.php

示例7: __construct

 public function __construct($user = null)
 {
     if (is_null($user)) {
         $user = \OCP\User::getUser();
     }
     $root = $user . '/files/';
     list($storage, $internalPath) = Filesystem::resolvePath($root);
     $this->fileview = new View($root);
     $this->cache = new Cache($storage);
 }
开发者ID:amin-hedayati,项目名称:videos,代码行数:10,代码来源:videos.php

示例8: setKey

 /**
  * write key to disk
  *
  *
  * @param string $path path to key directory
  * @param string $name key name
  * @param string $key key
  * @param \OC\Files\View $view
  * @return bool
  */
 private static function setKey($path, $name, $key, $view)
 {
     self::keySetPreparation($view, $path);
     /** @var \OCP\Files\Storage $storage */
     $pathToKey = \OC\Files\Filesystem::normalizePath($path . '/' . $name);
     list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($pathToKey);
     $result = $storage->file_put_contents($internalPath, $key);
     if (is_int($result) && $result > 0) {
         self::$key_cache[$pathToKey] = $key;
         return true;
     }
     return false;
 }
开发者ID:samj1912,项目名称:repo,代码行数:23,代码来源:keymanager.php

示例9: getNodeForPath

 /**
  * Returns the INode object for the requested path
  *
  * @param string $path
  * @throws \Sabre\DAV\Exception\ServiceUnavailable
  * @throws \Sabre\DAV\Exception\NotFound
  * @return \Sabre\DAV\INode
  */
 public function getNodeForPath($path)
 {
     if (!$this->fileView) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
     }
     $path = trim($path, '/');
     if (isset($this->cache[$path])) {
         return $this->cache[$path];
     }
     // Is it the root node?
     if (!strlen($path)) {
         return $this->rootNode;
     }
     if (pathinfo($path, PATHINFO_EXTENSION) === 'part') {
         // read from storage
         $absPath = $this->fileView->getAbsolutePath($path);
         list($storage, $internalPath) = Filesystem::resolvePath('/' . $absPath);
         if ($storage) {
             /**
              * @var \OC\Files\Storage\Storage $storage
              */
             $scanner = $storage->getScanner($internalPath);
             // get data directly
             $data = $scanner->getData($internalPath);
             $info = new FileInfo($absPath, $storage, $internalPath, $data);
         } else {
             $info = null;
         }
     } else {
         // read from cache
         try {
             $info = $this->fileView->getFileInfo($path);
         } catch (StorageNotAvailableException $e) {
             throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage not available');
         } catch (StorageInvalidException $e) {
             throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid');
         }
     }
     if (!$info) {
         throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
     }
     if ($info->getType() === 'dir') {
         $node = new \OC_Connector_Sabre_Directory($this->fileView, $info);
     } else {
         $node = new \OC_Connector_Sabre_File($this->fileView, $info);
     }
     $this->cache[$path] = $node;
     return $node;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:57,代码来源:objecttree.php

示例10: getFreeSpace

 /**
  * get the free space in the path's owner home folder
  * @param path
  * @return int
  */
 private function getFreeSpace($path)
 {
     /**
      * @var \OC\Files\Storage\Storage $storage
      * @var string $internalPath
      */
     list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path);
     $owner = $storage->getOwner($internalPath);
     if (!$owner) {
         return -1;
     }
     $totalSpace = $this->getQuota($owner);
     if ($totalSpace == -1) {
         return -1;
     }
     $view = new \OC\Files\View("/" . $owner . "/files");
     $rootInfo = $view->getFileInfo('/');
     $usedSpace = isset($rootInfo['size']) ? $rootInfo['size'] : 0;
     return $totalSpace - $usedSpace;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:25,代码来源:quota.php

示例11: getSourceCache

 /**
  * @brief Get the source cache of a shared file or folder
  * @param string $target Shared target file path
  * @return \OC\Files\Cache\Cache
  */
 private function getSourceCache($target)
 {
     $source = \OC_Share_Backend_File::getSource($target);
     if (isset($source['path']) && isset($source['fileOwner'])) {
         \OC\Files\Filesystem::initMountPoints($source['fileOwner']);
         $mount = \OC\Files\Mount::findByNumericId($source['storage']);
         if ($mount) {
             $fullPath = $mount->getMountPoint() . $source['path'];
             list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($fullPath);
             if ($storage) {
                 $this->files[$target] = $internalPath;
                 $cache = $storage->getCache();
                 $this->storageId = $storage->getId();
                 $this->numericId = $cache->getNumericStorageId();
                 return $cache;
             }
         }
     }
     return false;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:25,代码来源:cache.php

示例12: isExcludedPath

 /**
  * check if path is excluded from encryption
  *
  * @param string $path relative to data/
  * @param string $uid user
  * @return boolean
  */
 private function isExcludedPath($path, $uid)
 {
     $view = new \OC\Files\View();
     // files outside of the files-folder are excluded
     if (strpos($path, '/' . $uid . '/files') !== 0) {
         return true;
     }
     if (!$view->file_exists($path)) {
         $path = dirname($path);
     }
     // we don't encrypt server-to-server shares
     list($storage, ) = \OC\Files\Filesystem::resolvePath($path);
     /**
      * @var \OCP\Files\Storage $storage
      */
     if ($storage->instanceOfStorage('OCA\\Files_Sharing\\External\\Storage')) {
         return true;
     }
     return false;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:27,代码来源:proxy.php

示例13: isExcludedPath

 /**
  * check if path is excluded from encryption
  *
  * @param string $path relative to data/
  * @param string $uid user
  * @return boolean
  */
 protected function isExcludedPath($path, $uid)
 {
     $view = new \OC\Files\View();
     $path = \OC\Files\Filesystem::normalizePath($path);
     // we only encrypt/decrypt files in the files and files_versions folder
     if (strpos($path, '/' . $uid . '/files/') !== 0 && strpos($path, '/' . $uid . '/files_versions/') !== 0) {
         return true;
     }
     if (!$view->file_exists($path)) {
         $path = dirname($path);
     }
     // we don't encrypt server-to-server shares
     list($storage, ) = \OC\Files\Filesystem::resolvePath($path);
     /**
      * @var \OCP\Files\Storage $storage
      */
     if ($storage->instanceOfStorage('OCA\\Files_Sharing\\External\\Storage')) {
         return true;
     }
     return false;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:28,代码来源:proxy.php

示例14: getSourceCache

	/**
	 * Get the source cache of a shared file or folder
	 *
	 * @param string $target Shared target file path
	 * @return \OC\Files\Cache\Cache
	 */
	private function getSourceCache($target) {
		if ($target === false || $target === $this->storage->getMountPoint()) {
			$target = '';
		}
		$source = \OC_Share_Backend_File::getSource($target, $this->storage->getMountPoint(), $this->storage->getItemType());
		if (isset($source['path']) && isset($source['fileOwner'])) {
			\OC\Files\Filesystem::initMountPoints($source['fileOwner']);
			$mounts = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
			if (is_array($mounts) and !empty($mounts)) {
				$fullPath = $mounts[0]->getMountPoint() . $source['path'];
				list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($fullPath);
				if ($storage) {
					$this->files[$target] = $internalPath;
					$cache = $storage->getCache();
					$this->storageId = $storage->getId();
					$this->numericId = $cache->getNumericStorageId();
					return $cache;
				}
			}
		}
		return false;
	}
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:28,代码来源:cache.php

示例15: isTargetAllowed

 /**
  * check if it is allowed to move a mount point to a given target.
  * It is not allowed to move a mount point into a different mount point
  *
  * @param string $target path
  * @return boolean
  */
 private function isTargetAllowed($target)
 {
     $result = false;
     list($targetStorage, ) = \OC\Files\Filesystem::resolvePath($target);
     if ($targetStorage->instanceOfStorage('\\OCP\\Files\\IHomeStorage')) {
         $result = true;
     } else {
         \OCP\Util::writeLog('files', 'It is not allowed to move one mount point into another one', \OCP\Util::DEBUG);
     }
     return $result;
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:18,代码来源:view.php


注:本文中的OC\Files\Filesystem::resolvePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。