remove deleted files while scanning
This commit is contained in:
parent
057d7aa108
commit
3e7a86c6ec
2 changed files with 12 additions and 0 deletions
2
lib/files/cache/scanner.php
vendored
2
lib/files/cache/scanner.php
vendored
|
@ -112,6 +112,8 @@ class Scanner extends BasicEmitter {
|
|||
if (!empty($newData)) {
|
||||
$this->cache->put($file, $newData);
|
||||
}
|
||||
} else {
|
||||
$this->cache->remove($file);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
|
10
tests/lib/files/cache/scanner.php
vendored
10
tests/lib/files/cache/scanner.php
vendored
|
@ -166,6 +166,16 @@ class Scanner extends \PHPUnit_Framework_TestCase {
|
|||
$this->assertFalse($this->cache->inCache('folder/bar.txt'));
|
||||
}
|
||||
|
||||
public function testScanRemovedFile(){
|
||||
$this->fillTestFolders();
|
||||
|
||||
$this->scanner->scan('');
|
||||
$this->assertTrue($this->cache->inCache('folder/bar.txt'));
|
||||
$this->storage->unlink('folder/bar.txt');
|
||||
$this->scanner->scanFile('folder/bar.txt');
|
||||
$this->assertFalse($this->cache->inCache('folder/bar.txt'));
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
$this->storage = new \OC\Files\Storage\Temporary(array());
|
||||
$this->scanner = new \OC\Files\Cache\Scanner($this->storage);
|
||||
|
|
Loading…
Reference in a new issue