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


PHP Storage::getCache方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     // remember files_encryption state
     $this->stateFilesEncryption = \OC_App::isEnabled('files_encryption');
     // we want to tests with the encryption app disabled
     \OC_App::disable('files_encryption');
     $this->storage = new \OC\Files\Storage\Temporary(array());
     $textData = "dummy file data\n";
     $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
     $this->storage->mkdir('folder');
     $this->storage->file_put_contents('foo.txt', $textData);
     $this->storage->file_put_contents('foo.png', $imgData);
     $this->storage->file_put_contents('folder/bar.txt', $textData);
     $this->storage->file_put_contents('folder/bar2.txt', $textData);
     $this->scanner = $this->storage->getScanner();
     $this->scanner->scan('');
     $this->cache = $this->storage->getCache();
     \OC\Files\Filesystem::tearDown();
     if (!self::$user) {
         self::$user = uniqid();
     }
     \OC_User::createUser(self::$user, 'password');
     \OC_User::setUserId(self::$user);
     \OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files');
     Filesystem::clearMounts();
     Filesystem::mount($this->storage, array(), '/' . self::$user . '/files');
     \OC_Hook::clear('OC_Filesystem');
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:28,代码来源:updater.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: 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

示例4: setUp

	protected function setUp() {
		parent::setUp();

		$this->storage = new \OC\Files\Storage\Temporary(array());
		$textData = "dummy file data\n";
		$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo.png');
		$this->storage->mkdir('folder');
		$this->storage->file_put_contents('foo.txt', $textData);
		$this->storage->file_put_contents('foo.png', $imgData);
		$this->storage->file_put_contents('folder/bar.txt', $textData);
		$this->storage->file_put_contents('folder/bar2.txt', $textData);

		$this->scanner = $this->storage->getScanner();
		$this->scanner->scan('');
		$this->cache = $this->storage->getCache();

		if (!self::$user) {
			self::$user = $this->getUniqueID();
		}

		\OC_User::createUser(self::$user, 'password');
		$this->loginAsUser(self::$user);

		Filesystem::init(self::$user, '/' . self::$user . '/files');

		Filesystem::clearMounts();
		Filesystem::mount($this->storage, array(), '/' . self::$user . '/files');

		\OC_Hook::clear('OC_Filesystem');
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:30,代码来源:updaterlegacy.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->loginAsUser();
     $this->storage = new Temporary(array());
     $this->updater = $this->storage->getUpdater();
     $this->cache = $this->storage->getCache();
 }
开发者ID:evanjt,项目名称:core,代码行数:8,代码来源:updater.php

示例6: setUp

 public function setUp()
 {
     $this->storage = new Temporary(array());
     Filesystem::clearMounts();
     Filesystem::mount($this->storage, array(), '/');
     $this->view = new View('');
     $this->updater = new \OC\Files\Cache\Updater($this->view);
     $this->cache = $this->storage->getCache();
 }
开发者ID:Combustible,项目名称:core,代码行数:9,代码来源:updater.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->loginAsUser();
     $this->storage = new Temporary(array());
     Filesystem::mount($this->storage, array(), '/');
     $this->view = new View('');
     $this->updater = new \OC\Files\Cache\Updater($this->view);
     $this->cache = $this->storage->getCache();
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:10,代码来源:updater.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->originalStorage = Filesystem::getStorage('/');
     $this->storage = new Temporary(array());
     Filesystem::clearMounts();
     Filesystem::mount($this->storage, array(), '/');
     $this->view = new View('');
     $this->updater = new \OC\Files\Cache\Updater($this->view);
     $this->cache = $this->storage->getCache();
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:11,代码来源:updater.php

示例9: tearDown

 protected function tearDown()
 {
     $this->user = null;
     if ($this->storageMock) {
         $this->storageMock->getCache()->clear();
         $this->storageMock = null;
     }
     \OC\Files\Filesystem::tearDown();
     \OC\Files\Filesystem::mount($this->storage, array(), '/');
     \OC_User::setUserId('');
     \OC_User::deleteUser($this->user);
     \OC::$server->getConfig()->deleteAllUserValues($this->user);
     parent::tearDown();
 }
开发者ID:Commenter123,项目名称:core,代码行数:14,代码来源:helperstorage.php

示例10: testDontLowerMtime

 public function testDontLowerMtime()
 {
     $time = time();
     $this->view->mkdir('/foo');
     $this->view->mkdir('/foo/bar');
     $cache = $this->storage->getCache();
     $cache->put('', ['mtime' => $time - 50]);
     $cache->put('foo', ['mtime' => $time - 150]);
     $cache->put('foo/bar', ['mtime' => $time - 250]);
     $this->propagator->addChange('/foo/bar/foo');
     $this->propagator->propagateChanges($time - 100);
     $this->assertEquals(50, $time - $cache->get('')['mtime']);
     $this->assertEquals(100, $time - $cache->get('foo')['mtime']);
     $this->assertEquals(100, $time - $cache->get('foo/bar')['mtime']);
 }
开发者ID:kebenxiaoming,项目名称:core,代码行数:15,代码来源:changepropagator.php

示例11: __construct

 public function __construct(\OC\Files\Storage\Storage $storage)
 {
     $this->storage = $storage;
     $this->storageId = $this->storage->getId();
     $this->cache = $storage->getCache();
     $this->cacheActive = !Config::getSystemValue('filesystem_cache_readonly', false);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:7,代码来源:scanner.php

示例12: __construct

 /**
  * @param \OC\Files\Storage\Storage $storage
  */
 public function __construct(\OC\Files\Storage\Storage $storage)
 {
     $this->storage = $storage;
     $this->propagator = $storage->getPropagator();
     $this->scanner = $storage->getScanner();
     $this->cache = $storage->getCache();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:10,代码来源:Updater.php

示例13: getCache

 /**
  * get a cache instance for the storage
  *
  * @param string $path
  * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache
  * @return \OC\Files\Cache\Cache
  */
 public function getCache($path = '', $storage = null)
 {
     if (!$storage) {
         $storage = $this;
     }
     return $this->storage->getCache($path, $storage);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:14,代码来源:Wrapper.php

示例14: __construct

 public function __construct(\OC\Files\Storage\Storage $storage)
 {
     $this->storage = $storage;
     $this->storageId = $this->storage->getId();
     $this->cache = $storage->getCache();
     $this->permissionsCache = $storage->getPermissionsCache();
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:7,代码来源:scanner.php

示例15: propagateChange

 /**
  * @param string $internalPath
  * @param int $time
  * @return array[] all propagated entries
  */
 public function propagateChange($internalPath, $time)
 {
     $cache = $this->storage->getCache($internalPath);
     $parentId = $cache->getParentId($internalPath);
     $propagatedEntries = [];
     while ($parentId !== -1) {
         $entry = $cache->get($parentId);
         $propagatedEntries[] = $entry;
         if (!$entry) {
             return $propagatedEntries;
         }
         $mtime = max($time, $entry['mtime']);
         $cache->update($parentId, ['mtime' => $mtime, 'etag' => $this->storage->getETag($entry['path'])]);
         $parentId = $entry['parent'];
     }
     return $propagatedEntries;
 }
开发者ID:sunblade,项目名称:core,代码行数:22,代码来源:propagator.php


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