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


PHP View::resolvePath方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     // prepare user1's dir structure
     $textData = "dummy file data\n";
     $this->view->mkdir('container');
     $this->view->mkdir('container/shareddir');
     $this->view->mkdir('container/shareddir/subdir');
     $this->view->mkdir('container/shareddirrestricted');
     $this->view->mkdir('container/shareddirrestricted/subdir');
     $this->view->file_put_contents('container/shareddir/textfile.txt', $textData);
     $this->view->file_put_contents('container/shareddirrestricted/textfile1.txt', $textData);
     list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
     $this->ownerCache = $this->ownerStorage->getCache();
     $this->ownerStorage->getScanner()->scan('');
     // share "shareddir" with user2
     $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
     $node = $rootFolder->get('container/shareddir');
     $share = $this->shareManager->newShare();
     $share->setNode($node)->setShareType(\OCP\Share::SHARE_TYPE_USER)->setSharedWith(self::TEST_FILES_SHARING_API_USER2)->setSharedBy(self::TEST_FILES_SHARING_API_USER1)->setPermissions(\OCP\Constants::PERMISSION_ALL);
     $this->shareManager->createShare($share);
     $node = $rootFolder->get('container/shareddirrestricted');
     $share = $this->shareManager->newShare();
     $share->setNode($node)->setShareType(\OCP\Share::SHARE_TYPE_USER)->setSharedWith(self::TEST_FILES_SHARING_API_USER2)->setSharedBy(self::TEST_FILES_SHARING_API_USER1)->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
     $this->shareManager->createShare($share);
     // login as user2
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // retrieve the shared storage
     $this->secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
     list($this->sharedStorage, $internalPath) = $this->secondView->resolvePath('files/shareddir');
     list($this->sharedStorageRestrictedShare, $internalPath) = $this->secondView->resolvePath('files/shareddirrestricted');
     $this->sharedCache = $this->sharedStorage->getCache();
     $this->sharedCacheRestrictedShare = $this->sharedStorageRestrictedShare->getCache();
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:35,代码来源:permissions.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     // prepare user1's dir structure
     $textData = "dummy file data\n";
     $this->view->mkdir('container');
     $this->view->mkdir('container/shareddir');
     $this->view->mkdir('container/shareddir/subdir');
     $this->view->mkdir('container/shareddirrestricted');
     $this->view->mkdir('container/shareddirrestricted/subdir');
     $this->view->file_put_contents('container/shareddir/textfile.txt', $textData);
     $this->view->file_put_contents('container/shareddirrestricted/textfile1.txt', $textData);
     list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
     $this->ownerCache = $this->ownerStorage->getCache();
     $this->ownerStorage->getScanner()->scan('');
     // share "shareddir" with user2
     $fileinfo = $this->view->getFileInfo('container/shareddir');
     \OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     $fileinfo2 = $this->view->getFileInfo('container/shareddirrestricted');
     \OCP\Share::shareItem('folder', $fileinfo2['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 7);
     // login as user2
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // retrieve the shared storage
     $this->secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
     list($this->sharedStorage, $internalPath) = $this->secondView->resolvePath('files/shareddir');
     list($this->sharedStorageRestrictedShare, $internalPath) = $this->secondView->resolvePath('files/shareddirrestricted');
     $this->sharedCache = $this->sharedStorage->getCache();
     $this->sharedCacheRestrictedShare = $this->sharedStorageRestrictedShare->getCache();
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:30,代码来源:permissions.php

示例3: testKeepFileAndVersionsWhenMovingFolderBetweenStorages

 /**
  * Test that versions are not auto-trashed when moving a file between
  * storages. This is because rename() between storages would call
  * unlink() which should NOT trigger the version deletion logic.
  */
 public function testKeepFileAndVersionsWhenMovingFolderBetweenStorages()
 {
     \OCA\Files_Versions\Hooks::connectHooks();
     $storage2 = new Temporary(array());
     \OC\Files\Filesystem::mount($storage2, array(), $this->user . '/files/substorage');
     // trigger a version (multiple would not work because of the expire logic)
     $this->userView->file_put_contents('folder/inside.txt', 'v1');
     $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files');
     $this->assertEquals(0, count($results));
     $results = $this->rootView->getDirectoryContent($this->user . '/files_versions/folder/');
     $this->assertEquals(1, count($results));
     // move to another storage
     $this->userView->rename('folder', 'substorage/folder');
     $this->assertTrue($this->userView->file_exists('substorage/folder/inside.txt'));
     // rescan trash storage
     list($rootStorage, ) = $this->rootView->resolvePath($this->user . '/files_trashbin');
     $rootStorage->getScanner()->scan('');
     // versions were moved too
     $results = $this->rootView->getDirectoryContent($this->user . '/files_versions/substorage/folder/');
     $this->assertEquals(1, count($results));
     // check that nothing got trashed by the rename's unlink() call
     $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files');
     $this->assertEquals(0, count($results));
     // check that versions were moved and not trashed
     $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/versions/');
     $this->assertEquals(0, count($results));
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:32,代码来源:storage.php

示例4: testRestoreFileIntoReadOnlySourceFolder

 /**
  * Test restoring a file into a read-only folder, will restore
  * the file to root instead
  */
 public function testRestoreFileIntoReadOnlySourceFolder()
 {
     $userFolder = \OC::$server->getUserFolder();
     $folder = $userFolder->newFolder('folder');
     $file = $folder->newFile('file1.txt');
     $file->putContent('foo');
     $this->assertTrue($userFolder->nodeExists('folder/file1.txt'));
     $file->delete();
     $this->assertFalse($userFolder->nodeExists('folder/file1.txt'));
     $filesInTrash = OCA\Files_Trashbin\Helper::getTrashFiles('/', self::TEST_TRASHBIN_USER1, 'mtime');
     $this->assertCount(1, $filesInTrash);
     /** @var \OCP\Files\FileInfo */
     $trashedFile = $filesInTrash[0];
     // delete source folder
     list($storage, $internalPath) = $this->rootView->resolvePath('/' . self::TEST_TRASHBIN_USER1 . '/files/folder');
     if ($storage instanceof \OC\Files\Storage\Local) {
         $folderAbsPath = $storage->getSourcePath($internalPath);
         // make folder read-only
         chmod($folderAbsPath, 0555);
         $this->assertTrue(OCA\Files_Trashbin\Trashbin::restore('file1.txt.d' . $trashedFile->getMtime(), $trashedFile->getName(), $trashedFile->getMtime()));
         $file = $userFolder->get('file1.txt');
         $this->assertEquals('foo', $file->getContent());
         chmod($folderAbsPath, 0755);
     }
 }
开发者ID:loulancn,项目名称:core,代码行数:29,代码来源:trashbin.php

示例5: isLocal

 public function isLocal()
 {
     $this->init();
     $ownerPath = $this->ownerView->getPath($this->share['item_source']);
     list($targetStorage) = $this->ownerView->resolvePath($ownerPath);
     return $targetStorage->isLocal();
 }
开发者ID:Pookay,项目名称:core,代码行数:7,代码来源:sharedstorage.php

示例6: propagateChanges

 /**
  * propagate the registered changes to their parent folders
  *
  * @param int $time (optional) the mtime to set for the folders, if not set the current time is used
  */
 public function propagateChanges($time = null)
 {
     $parents = $this->getAllParents();
     $this->changedFiles = array();
     if (!$time) {
         $time = time();
     }
     foreach ($parents as $parent) {
         /**
          * @var \OC\Files\Storage\Storage $storage
          * @var string $internalPath
          */
         list($storage, $internalPath) = $this->view->resolvePath($parent);
         $cache = $storage->getCache();
         $id = $cache->getId($internalPath);
         $cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath)));
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:23,代码来源:changepropagator.php

示例7: setUp

 function setUp()
 {
     // reset backend
     \OC_User::useBackend('database');
     // set user id
     \OC_User::setUserId(\Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1);
     $this->userId = \Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1;
     $this->pass = \Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1;
     // init filesystem view
     $this->view = new \OC\Files\View('/');
     list($this->storage, ) = $this->view->resolvePath('/');
     // init short data
     $this->dataShort = 'hats';
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     // we don't want to tests with app files_trashbin enabled
     \OC_App::disable('files_trashbin');
     // create test user
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Webdav::TEST_ENCRYPTION_WEBDAV_USER1);
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:20,代码来源:webdav.php

示例8: propagateChanges

 /**
  * propagate the registered changes to their parent folders
  *
  * @param int $time (optional) the mtime to set for the folders, if not set the current time is used
  */
 public function propagateChanges($time = null)
 {
     $parents = $this->getAllParents();
     $this->changedFiles = array();
     if (!$time) {
         $time = time();
     }
     foreach ($parents as $parent) {
         /**
          * @var \OC\Files\Storage\Storage $storage
          * @var string $internalPath
          */
         list($storage, $internalPath) = $this->view->resolvePath($parent);
         if ($storage) {
             $cache = $storage->getCache();
             $entry = $cache->get($internalPath);
             $cache->update($entry['fileid'], array('mtime' => max($time, $entry['mtime']), 'etag' => $storage->getETag($internalPath)));
             $this->emit('\\OC\\Files', 'propagate', [$parent, $entry]);
         }
     }
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:26,代码来源:changepropagator.php

示例9: createAndCheckVersions

 /**
  * @param \OC\Files\View $view
  * @param string $path
  */
 private function createAndCheckVersions(\OC\Files\View $view, $path)
 {
     $view->file_put_contents($path, 'test file');
     $view->file_put_contents($path, 'version 1');
     $view->file_put_contents($path, 'version 2');
     $this->loginAsUser(self::TEST_VERSIONS_USER);
     // need to scan for the versions
     list($rootStorage, ) = $this->rootView->resolvePath(self::TEST_VERSIONS_USER . '/files_versions');
     $rootStorage->getScanner()->scan('files_versions');
     $versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, '/' . $path);
     // note: we cannot predict how many versions are created due to
     // test run timing
     $this->assertGreaterThan(0, count($versions));
 }
开发者ID:nem0xff,项目名称:core,代码行数:18,代码来源:versions.php

示例10: init

 private function init()
 {
     if ($this->initialized) {
         return;
     }
     $this->initialized = true;
     try {
         Filesystem::initMountPoints($this->superShare->getShareOwner());
         $sourcePath = $this->ownerView->getPath($this->superShare->getNodeId());
         list($this->sourceStorage, $sourceInternalPath) = $this->ownerView->resolvePath($sourcePath);
         $this->sourceRootInfo = $this->sourceStorage->getCache()->get($sourceInternalPath);
     } catch (\Exception $e) {
         $this->logger->logException($e);
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:15,代码来源:sharedstorage.php

示例11: getKey

 /**
  * read key from hard disk
  *
  * @param string $path to key
  * @param \OC\Files\View $view
  * @return string|bool either the key or false
  */
 private static function getKey($path, $view)
 {
     $key = false;
     if (isset(self::$key_cache[$path])) {
         $key = self::$key_cache[$path];
     } else {
         /** @var \OCP\Files\Storage $storage */
         list($storage, $internalPath) = $view->resolvePath($path);
         if ($storage->file_exists($internalPath)) {
             $key = $storage->file_get_contents($internalPath);
             self::$key_cache[$path] = $key;
         }
     }
     return $key;
 }
开发者ID:samj1912,项目名称:repo,代码行数:22,代码来源:keymanager.php

示例12: rename

	/**
	 * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
	 *
	 * @param string $source
	 * @param string $target
	 */
	public function rename($source, $target) {
		if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
			return;
		}
		/**
		 * @var \OC\Files\Storage\Storage $sourceStorage
		 * @var \OC\Files\Storage\Storage $targetStorage
		 * @var string $sourceInternalPath
		 * @var string $targetInternalPath
		 */
		list($sourceStorage, $sourceInternalPath) = $this->view->resolvePath($source);
		// if it's a moved mountpoint we dont need to do anything
		if ($sourceInternalPath === '') {
			return;
		}
		list($targetStorage, $targetInternalPath) = $this->view->resolvePath($target);

		if ($sourceStorage && $targetStorage) {
			$targetCache = $targetStorage->getCache($sourceInternalPath);
			if ($sourceStorage->getCache($sourceInternalPath)->inCache($sourceInternalPath)) {
				if ($targetCache->inCache($targetInternalPath)) {
					$targetCache->remove($targetInternalPath);
				}
				if ($sourceStorage === $targetStorage) {
					$targetCache->move($sourceInternalPath, $targetInternalPath);
				} else {
					$targetCache->moveFromCache($sourceStorage->getCache(), $sourceInternalPath, $targetInternalPath);
				}
			}

			if (pathinfo($sourceInternalPath, PATHINFO_EXTENSION) !== pathinfo($targetInternalPath, PATHINFO_EXTENSION)) {
				// handle mime type change
				$mimeType = $targetStorage->getMimeType($targetInternalPath);
				$fileId = $targetCache->getId($targetInternalPath);
				$targetCache->update($fileId, array('mimetype' => $mimeType));
			}

			$targetCache->correctFolderSize($sourceInternalPath);
			$targetCache->correctFolderSize($targetInternalPath);
			$this->correctParentStorageMtime($sourceStorage, $sourceInternalPath);
			$this->correctParentStorageMtime($targetStorage, $targetInternalPath);
			$this->propagator->addChange($this->getPropagatorPath($source));
			$this->propagator->addChange($this->getPropagatorPath($target));
			$this->propagator->propagateChanges();
		}
	}
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:52,代码来源:updater.php

示例13: copyFileContents

 /**
  * Stream copy file contents from $path1 to $path2
  *
  * @param \OC\Files\View $view view to use for copying
  * @param string $path1 source file to copy
  * @param string $path2 target file
  *
  * @return bool true for success, false otherwise
  */
 private static function copyFileContents($view, $path1, $path2)
 {
     /** @var \OC\Files\Storage\Storage $storage1 */
     list($storage1, $internalPath1) = $view->resolvePath($path1);
     /** @var \OC\Files\Storage\Storage $storage2 */
     list($storage2, $internalPath2) = $view->resolvePath($path2);
     $view->lockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
     $view->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
     $result = $storage2->moveFromStorage($storage1, $internalPath1, $internalPath2);
     $view->unlockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
     $view->unlockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
     return $result !== false;
 }
开发者ID:0x17de,项目名称:core,代码行数:22,代码来源:storage.php

示例14: getInternalPath

 /**
  * @return string
  */
 public function getInternalPath()
 {
     list(, $internalPath) = $this->view->resolvePath($this->path);
     return $internalPath;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:8,代码来源:node.php

示例15: copyFileContents

 /**
  * Stream copy file contents from $path1 to $path2
  *
  * @param \OC\Files\View $view view to use for copying
  * @param string $path1 source file to copy
  * @param string $path2 target file
  *
  * @return bool true for success, false otherwise
  */
 private static function copyFileContents($view, $path1, $path2)
 {
     list($storage1, $internalPath1) = $view->resolvePath($path1);
     list($storage2, $internalPath2) = $view->resolvePath($path2);
     $result = $storage2->moveFromStorage($storage1, $internalPath1, $internalPath2);
     return $result !== false;
 }
开发者ID:brunomilet,项目名称:owncloud-core,代码行数:16,代码来源:storage.php


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