Dont lower the mtime of a folder when propagating changes
This commit is contained in:
parent
1393563965
commit
134243d3e5
|
@ -59,8 +59,8 @@ class ChangePropagator {
|
||||||
list($storage, $internalPath) = $this->view->resolvePath($parent);
|
list($storage, $internalPath) = $this->view->resolvePath($parent);
|
||||||
if ($storage) {
|
if ($storage) {
|
||||||
$cache = $storage->getCache();
|
$cache = $storage->getCache();
|
||||||
$id = $cache->getId($internalPath);
|
$entry = $cache->get($internalPath);
|
||||||
$cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath)));
|
$cache->update($entry['fileid'], array('mtime' => max($time, $entry['mtime']), 'etag' => $storage->getETag($internalPath)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,17 @@ class ChangePropagator extends \Test\TestCase {
|
||||||
*/
|
*/
|
||||||
private $view;
|
private $view;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \OC\Files\Storage\Storage
|
||||||
|
*/
|
||||||
|
private $storage;
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$storage = new Temporary(array());
|
$this->storage = new Temporary(array());
|
||||||
$root = $this->getUniqueID('/');
|
$root = $this->getUniqueID('/');
|
||||||
Filesystem::mount($storage, array(), $root);
|
Filesystem::mount($this->storage, array(), $root);
|
||||||
$this->view = new View($root);
|
$this->view = new View($root);
|
||||||
$this->propagator = new \OC\Files\Cache\ChangePropagator($this->view);
|
$this->propagator = new \OC\Files\Cache\ChangePropagator($this->view);
|
||||||
}
|
}
|
||||||
|
@ -71,4 +76,22 @@ class ChangePropagator extends \Test\TestCase {
|
||||||
$this->assertNotSame($oldInfo2->getEtag(), $newInfo2->getEtag());
|
$this->assertNotSame($oldInfo2->getEtag(), $newInfo2->getEtag());
|
||||||
$this->assertNotSame($oldInfo3->getEtag(), $newInfo3->getEtag());
|
$this->assertNotSame($oldInfo3->getEtag(), $newInfo3->getEtag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDontLowerMtime() {
|
||||||
|
$time = time();
|
||||||
|
$this->view->mkdir('/foo');
|
||||||
|
$this->view->mkdir('/foo/bar');
|
||||||
|
|
||||||
|
$cache = $this->storage->getCache();
|
||||||
|
$cache->put('', ['mtime' => $time - 50]);
|
||||||
|
$cache->put('foo', ['mtime' => $time - 150]);
|
||||||
|
$cache->put('foo/bar', ['mtime' => $time - 250]);
|
||||||
|
|
||||||
|
$this->propagator->addChange('/foo/bar/foo');
|
||||||
|
$this->propagator->propagateChanges($time - 100);
|
||||||
|
|
||||||
|
$this->assertEquals(50, $time - $cache->get('')['mtime']);
|
||||||
|
$this->assertEquals(100, $time - $cache->get('foo')['mtime']);
|
||||||
|
$this->assertEquals(100, $time - $cache->get('foo/bar')['mtime']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue