aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-08-06 15:59:06 +0200
committerRobin Appelman <icewind@owncloud.com>2013-08-06 15:59:06 +0200
commit3e7a86c6ecd332c268e690399a015ab618e87754 (patch)
tree40487f94e73e07489fc2d05579eb1fa458e348c9
parent057d7aa108f9b24c12b97f5f78008eb17a6d3bee (diff)
downloadnextcloud-server-3e7a86c6ecd332c268e690399a015ab618e87754.tar.gz
nextcloud-server-3e7a86c6ecd332c268e690399a015ab618e87754.zip
remove deleted files while scanning
-rw-r--r--lib/files/cache/scanner.php2
-rw-r--r--tests/lib/files/cache/scanner.php10
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index adecc2bb901..3349245616d 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -112,6 +112,8 @@ class Scanner extends BasicEmitter {
if (!empty($newData)) {
$this->cache->put($file, $newData);
}
+ } else {
+ $this->cache->remove($file);
}
return $data;
}
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index 263ceadccc7..bb90adce5c1 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -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);