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


PHP Cache::getById方法代码示例

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


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

示例1: checkUpdate

 private static function checkUpdate($id)
 {
     $cacheItem = Cache::getById($id);
     if (is_null($cacheItem)) {
         return;
     }
     list($storageId, $internalPath) = $cacheItem;
     $mounts = Filesystem::getMountByStorageId($storageId);
     if (count($mounts) === 0) {
         //if the storage we need isn't mounted on default, try to find a user that has access to the storage
         $permissionsCache = new Permissions($storageId);
         $users = $permissionsCache->getUsers($id);
         if (count($users) === 0) {
             return;
         }
         Filesystem::initMountPoints($users[0]);
         $mounts = Filesystem::getMountByStorageId($storageId);
         if (count($mounts) === 0) {
             return;
         }
     }
     $storage = $mounts[0]->getStorage();
     $watcher = new Watcher($storage);
     $watcher->checkUpdate($internalPath);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:25,代码来源:backgroundwatcher.php

示例2: testUpdateLegacyAndNewId

 public function testUpdateLegacyAndNewId()
 {
     // add storage ids
     $oldCache = new \OC\Files\Cache\Cache($this->oldId);
     new \OC\Files\Cache\Cache($this->newId);
     // add file to old cache
     $fileId = $oldCache->put('/', array('size' => 0, 'mtime' => time(), 'mimetype' => 'httpd/directory'));
     try {
         $this->instance = new \OC\Files\Storage\AmazonS3($this->params);
     } catch (\Exception $e) {
         //ignore
     }
     $storages = $this->getStorages();
     $this->assertTrue(isset($storages[$this->newId]));
     $this->assertFalse(isset($storages[$this->oldId]));
     $this->assertNull(\OC\Files\Cache\Cache::getById($fileId), 'old filecache has not been cleared');
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:17,代码来源:amazons3migration.php

示例3: testLongId

 function testLongId()
 {
     $storage = new LongId(array());
     $cache = $storage->getCache();
     $storageId = $storage->getId();
     $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file');
     $id = $cache->put('foo', $data);
     $this->assertEquals(array(md5($storageId), 'foo'), \OC\Files\Cache\Cache::getById($id));
 }
开发者ID:Romua1d,项目名称:core,代码行数:9,代码来源:cache.php

示例4: getById

 /**
  * get the storage id of the storage for a file and the internal path of the file
  * unlike getPathById this does not limit the search to files on this storage and
  * instead does a global search in the cache table
  *
  * @param int $id
  * @return array, first element holding the storage id, second the path
  */
 public static function getById($id)
 {
     return parent::getById($id);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:12,代码来源:cachewrapper.php

示例5: getLocalFileOwnerAndPath

 protected function getLocalFileOwnerAndPath()
 {
     $fileInfo = \OC\Files\Cache\Cache::getById($this->fileId);
     $owner = \OCP\User::getUser();
     if (!$owner) {
         throw new Exception('Guest users can\'t access local files. This one was probably unshared recently.');
     }
     return array($owner, @$fileInfo[1]);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:9,代码来源:file.php

示例6: getPathWithMountPoint

 /**
  * Get the path including the storage mount point
  * @param int $id
  * @return string the path including the mount point like AmazonS3/folder/file.txt
  */
 public function getPathWithMountPoint($id)
 {
     list($storage, $internalPath) = \OC\Files\Cache\Cache::getById($id);
     $mount = \OC\Files\Filesystem::getMountByStorageId($storage);
     $mountPoint = $mount[0]->getMountPoint();
     $path = \OC\Files\Filesystem::normalizePath($mountPoint . '/' . $internalPath);
     // reformat the path to be relative e.g. /user/files/folder becomes /folder/
     $relativePath = \OCA\Encryption\Helper::stripUserFilesPath($path);
     return $relativePath;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:15,代码来源:util.php

示例7: getById

 /**
  * search file by id
  *
  * An array is returned because in the case where a single storage is mounted in different places the same file
  * can exist in different places
  *
  * @param int $id
  * @throws \OCP\Files\NotFoundException
  * @return Node[]
  */
 public function getById($id)
 {
     $result = Cache::getById($id);
     if (is_null($result)) {
         throw new NotFoundException();
     } else {
         list($storageId, $internalPath) = $result;
         $nodes = array();
         $mounts = $this->mountManager->findByStorageId($storageId);
         foreach ($mounts as $mount) {
             $nodes[] = $this->get($mount->getMountPoint() . $internalPath);
         }
         return $nodes;
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:25,代码来源:root.php

示例8: isValidSource

 public function isValidSource($itemSource, $uidOwner)
 {
     return is_array(\OC\Files\Cache\Cache::getById($itemSource));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:4,代码来源:share.php


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