From 3e732517503b50e8d399d1554e08a66eb114ffaf Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 5 Jun 2014 10:08:25 +0200 Subject: [PATCH 1/2] Don't update the mtime if the storage mtime hasn't changed --- lib/private/files/cache/scanner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index 6cb9807f5a..1315d027c4 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -129,6 +129,7 @@ class Scanner extends BasicEmitter { } // only reuse data if the file hasn't explicitly changed if (isset($data['storage_mtime']) && isset($cacheData['storage_mtime']) && $data['storage_mtime'] === $cacheData['storage_mtime']) { + $data['mtime'] = $cacheData['mtime']; if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) { $data['size'] = $cacheData['size']; } From 9dab6ec2ec29852a32b2d3f21f3115c86c3797bc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 5 Jun 2014 11:31:55 +0200 Subject: [PATCH 2/2] Fix uit tests --- tests/lib/files/utils/scanner.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lib/files/utils/scanner.php b/tests/lib/files/utils/scanner.php index 159a2a4867..5e5cc6ac12 100644 --- a/tests/lib/files/utils/scanner.php +++ b/tests/lib/files/utils/scanner.php @@ -112,7 +112,7 @@ class Scanner extends \PHPUnit_Framework_TestCase { $this->assertEquals(array('/foo', '/foo/folder', '/foo/folder/bar.txt', '/foo/foo.txt'), $changes); $this->assertEquals(array('/', '/foo', '/foo/folder'), $parents); - $cache->put('foo.txt', array('mtime' => time() - 50)); + $cache->put('foo.txt', array('storage_mtime' => time() - 50)); $propagator = $this->getMock('\OC\Files\Cache\ChangePropagator', array('propagateChanges'), array(), '', false); $scanner->setPropagator($propagator); @@ -128,7 +128,7 @@ class Scanner extends \PHPUnit_Framework_TestCase { $scanner->setPropagator($originalPropagator); $oldInfo = $cache->get(''); - $cache->put('foo.txt', array('mtime' => time() - 70)); + $cache->put('foo.txt', array('storage_mtime' => time() - 70)); $storage->file_put_contents('foo.txt', 'asdasd'); $scanner->scan('');