Merge pull request #8889 from owncloud/mtime-reuse

Don't update the mtime if the storage mtime hasn't changed
This commit is contained in:
Thomas Müller 2014-06-05 13:18:18 +02:00
commit e1beb8c6c3
2 changed files with 3 additions and 2 deletions

View File

@ -121,6 +121,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'];
}

View File

@ -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('');