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


PHP Cache::correctFolderSize方法代码示例

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


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

示例1: testShallow

	function testShallow() {
		$this->fillTestFolders();

		$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW);
		$this->assertEquals($this->cache->inCache(''), true);
		$this->assertEquals($this->cache->inCache('foo.txt'), true);
		$this->assertEquals($this->cache->inCache('foo.png'), true);
		$this->assertEquals($this->cache->inCache('folder'), true);
		$this->assertEquals($this->cache->inCache('folder/bar.txt'), false);

		$cachedDataFolder = $this->cache->get('');
		$cachedDataFolder2 = $this->cache->get('folder');

		$this->assertEquals(-1, $cachedDataFolder['size']);
		$this->assertEquals(-1, $cachedDataFolder2['size']);

		$this->scanner->scan('folder', \OC\Files\Cache\Scanner::SCAN_SHALLOW);

		$cachedDataFolder2 = $this->cache->get('folder');

		$this->assertNotEquals($cachedDataFolder2['size'], -1);

		$this->cache->correctFolderSize('folder');

		$cachedDataFolder = $this->cache->get('');
		$this->assertNotEquals($cachedDataFolder['size'], -1);
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:27,代码来源:scanner.php

示例2: renameFromStorage

 /**
  * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
  *
  * @param IStorage $sourceStorage
  * @param string $source
  * @param string $target
  */
 public function renameFromStorage(IStorage $sourceStorage, $source, $target)
 {
     if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
         return;
     }
     $time = time();
     $sourceCache = $sourceStorage->getCache();
     $sourceUpdater = $sourceStorage->getUpdater();
     $sourcePropagator = $sourceStorage->getPropagator();
     if ($sourceCache->inCache($source)) {
         if ($this->cache->inCache($target)) {
             $this->cache->remove($target);
         }
         if ($sourceStorage === $this->storage) {
             $this->cache->move($source, $target);
         } else {
             $this->cache->moveFromCache($sourceCache, $source, $target);
         }
     }
     if (pathinfo($source, PATHINFO_EXTENSION) !== pathinfo($target, PATHINFO_EXTENSION)) {
         // handle mime type change
         $mimeType = $this->storage->getMimeType($target);
         $fileId = $this->cache->getId($target);
         $this->cache->update($fileId, ['mimetype' => $mimeType]);
     }
     $sourceCache->correctFolderSize($source);
     $this->cache->correctFolderSize($target);
     if ($sourceUpdater instanceof Updater) {
         $sourceUpdater->correctParentStorageMtime($source);
     }
     $this->correctParentStorageMtime($target);
     $this->updateStorageMTimeOnly($target);
     $sourcePropagator->propagateChange($source, $time);
     $this->propagator->propagateChange($target, $time);
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:42,代码来源:updater.php

示例3: backgroundScan

 /**
  * walk over any folders that are not fully scanned yet and scan them
  */
 public function backgroundScan()
 {
     $lastPath = null;
     while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
         $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
         $this->cache->correctFolderSize($path);
         $lastPath = $path;
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:12,代码来源:scanner.php

示例4: backgroundScan

	/**
	 * walk over any folders that are not fully scanned yet and scan them
	 */
	public function backgroundScan() {
		$lastPath = null;
		while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
			$this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
			\OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path));
			if ($this->cacheActive) {
				$this->cache->correctFolderSize($path);
			}
			$lastPath = $path;
		}
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:14,代码来源:scanner.php

示例5: update

 /**
  * Update the cache for changes to $path
  *
  * @param string $path
  * @param ICacheEntry $cachedData
  */
 public function update($path, $cachedData)
 {
     if ($this->storage->is_dir($path)) {
         $this->scanner->scan($path, Scanner::SCAN_SHALLOW);
     } else {
         $this->scanner->scanFile($path);
     }
     if ($cachedData['mimetype'] === 'httpd/unix-directory') {
         $this->cleanFolder($path);
     }
     $this->cache->correctFolderSize($path);
 }
开发者ID:kenwi,项目名称:core,代码行数:18,代码来源:watcher.php

示例6: runBackgroundScanJob

 private function runBackgroundScanJob(callable $callback, $path)
 {
     try {
         $callback();
         \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path));
         if ($this->cacheActive && $this->cache instanceof Cache) {
             $this->cache->correctFolderSize($path);
         }
     } catch (\OCP\Files\StorageInvalidException $e) {
         // skip unavailable storages
     } catch (\OCP\Files\StorageNotAvailableException $e) {
         // skip unavailable storages
     } catch (\OCP\Files\ForbiddenException $e) {
         // skip forbidden storages
     } catch (\OCP\Lock\LockedException $e) {
         // skip unavailable storages
     }
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:18,代码来源:Scanner.php

示例7: backgroundScan

 /**
  * walk over any folders that are not fully scanned yet and scan them
  */
 public function backgroundScan()
 {
     $lastPath = null;
     while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
         try {
             $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
             \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path));
             if ($this->cacheActive) {
                 $this->cache->correctFolderSize($path);
             }
         } catch (\OCP\Files\StorageInvalidException $e) {
             // skip unavailable storages
         } catch (\OCP\Files\StorageNotAvailableException $e) {
             // skip unavailable storages
         } catch (\OCP\Lock\LockedException $e) {
             // skip unavailable storages
         }
         // FIXME: this won't proceed with the next item, needs revamping of getIncomplete()
         // to make this possible
         $lastPath = $path;
     }
 }
开发者ID:ElAutoestopista,项目名称:core,代码行数:25,代码来源:scanner.php

示例8: correctFolderSize

 /**
  * update the folder size and the size of all parent folders
  *
  * @param string|boolean $path
  * @param array $data (optional) meta data of the folder
  */
 public function correctFolderSize($path, $data = null)
 {
     $this->cache->correctFolderSize($path, $data);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:10,代码来源:cachewrapper.php


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