本文整理匯總了PHP中OC\Files\Cache\Cache::getIncomplete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::getIncomplete方法的具體用法?PHP Cache::getIncomplete怎麽用?PHP Cache::getIncomplete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OC\Files\Cache\Cache
的用法示例。
在下文中一共展示了Cache::getIncomplete方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
}
示例2: 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;
}
}
示例3: testGetIncomplete
function testGetIncomplete()
{
$file1 = 'folder1';
$file2 = 'folder2';
$file3 = 'folder3';
$file4 = 'folder4';
$data = array('size' => 10, 'mtime' => 50, 'mimetype' => 'foo/bar');
$this->cache->put($file1, $data);
$data['size'] = -1;
$this->cache->put($file2, $data);
$this->cache->put($file3, $data);
$data['size'] = 12;
$this->cache->put($file4, $data);
$this->assertEquals($file3, $this->cache->getIncomplete());
}
示例4: testBackgroundScan
function testBackgroundScan()
{
$this->fillTestFolders();
$this->storage->mkdir('folder2');
$this->storage->file_put_contents('folder2/bar.txt', 'foobar');
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW);
$this->assertFalse($this->cache->inCache('folder/bar.txt'));
$this->assertFalse($this->cache->inCache('folder/2bar.txt'));
$cachedData = $this->cache->get('');
$this->assertEquals(-1, $cachedData['size']);
$this->scanner->backgroundScan();
$this->assertTrue($this->cache->inCache('folder/bar.txt'));
$this->assertTrue($this->cache->inCache('folder/bar.txt'));
$cachedData = $this->cache->get('');
$this->assertnotEquals(-1, $cachedData['size']);
$this->assertFalse($this->cache->getIncomplete());
}
示例5: backgroundScan
/**
* walk over any folders that are not fully scanned yet and scan them
*/
public function backgroundScan()
{
if (!$this->cache->inCache('')) {
$this->runBackgroundScanJob(function () {
$this->scan('', self::SCAN_RECURSIVE, self::REUSE_ETAG);
}, '');
} else {
$lastPath = null;
while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
$this->runBackgroundScanJob(function () use($path) {
$this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
}, $path);
// FIXME: this won't proceed with the next item, needs revamping of getIncomplete()
// to make this possible
$lastPath = $path;
}
}
}
示例6: testBackgroundScanOnlyRecurseIncomplete
function testBackgroundScanOnlyRecurseIncomplete()
{
$this->fillTestFolders();
$this->storage->mkdir('folder2');
$this->storage->file_put_contents('folder2/bar.txt', 'foobar');
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW);
$this->assertFalse($this->cache->inCache('folder/bar.txt'));
$this->assertFalse($this->cache->inCache('folder/2bar.txt'));
$this->assertFalse($this->cache->inCache('folder2/bar.txt'));
$this->cache->put('folder2', ['size' => 1]);
// mark as complete
$cachedData = $this->cache->get('');
$this->assertEquals(-1, $cachedData['size']);
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE_INCOMPLETE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE);
$this->assertTrue($this->cache->inCache('folder/bar.txt'));
$this->assertTrue($this->cache->inCache('folder/bar.txt'));
$this->assertFalse($this->cache->inCache('folder2/bar.txt'));
$cachedData = $this->cache->get('');
$this->assertNotEquals(-1, $cachedData['size']);
$this->assertFalse($this->cache->getIncomplete());
}
示例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;
}
}
示例8: getIncomplete
/**
* find a folder in the cache which has not been fully scanned
*
* If multiple incomplete folders are in the cache, the one with the highest id will be returned,
* use the one with the highest id gives the best result with the background scanner, since that is most
* likely the folder where we stopped scanning previously
*
* @return string|bool the path of the folder or false when no folder matched
*/
public function getIncomplete()
{
return $this->cache->getIncomplete();
}