Merge pull request #4327 from owncloud/scanfile-remove

remove deleted files while scanning
This commit is contained in:
Thomas Müller 2013-09-22 22:40:13 -07:00
commit 03eedb58fc
2 changed files with 12 additions and 0 deletions

View File

@ -112,6 +112,8 @@ class Scanner extends BasicEmitter {
if (!empty($newData)) {
$this->cache->put($file, $newData);
}
} else {
$this->cache->remove($file);
}
return $data;
}

View File

@ -184,6 +184,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);