aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-22 22:40:13 -0700
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-22 22:40:13 -0700
commit03eedb58fc3529d27238959415b0f2904a0695e6 (patch)
tree42c33300a4619fd4b306dfedcc7c987386fec819
parent811f6804570af9a8d6a507d5aef4eb97cf36393e (diff)
parent3e7a86c6ecd332c268e690399a015ab618e87754 (diff)
downloadnextcloud-server-03eedb58fc3529d27238959415b0f2904a0695e6.tar.gz
nextcloud-server-03eedb58fc3529d27238959415b0f2904a0695e6.zip
Merge pull request #4327 from owncloud/scanfile-remove
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 9d180820e9d..dcc5d8c5581 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 f6deb93a49e..4c90119814a 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -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);