round the mtime in touch
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
494ccee0f1
commit
d212a5167d
|
@ -564,7 +564,7 @@ class View {
|
||||||
$mtime = time();
|
$mtime = time();
|
||||||
}
|
}
|
||||||
//if native touch fails, we emulate it by changing the mtime in the cache
|
//if native touch fails, we emulate it by changing the mtime in the cache
|
||||||
$this->putFileInfo($path, array('mtime' => $mtime));
|
$this->putFileInfo($path, array('mtime' => floor($mtime)));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace Test\Files;
|
||||||
|
|
||||||
use OC\Cache\CappedMemoryCache;
|
use OC\Cache\CappedMemoryCache;
|
||||||
use OC\Files\Cache\Watcher;
|
use OC\Files\Cache\Watcher;
|
||||||
|
use OC\Files\Filesystem;
|
||||||
use OC\Files\Storage\Common;
|
use OC\Files\Storage\Common;
|
||||||
use OC\Files\Mount\MountPoint;
|
use OC\Files\Mount\MountPoint;
|
||||||
use OC\Files\Storage\Temporary;
|
use OC\Files\Storage\Temporary;
|
||||||
|
@ -558,6 +559,23 @@ class ViewTest extends \Test\TestCase {
|
||||||
$this->assertEquals($cachedData['storage_mtime'], $cachedData['mtime']);
|
$this->assertEquals($cachedData['storage_mtime'], $cachedData['mtime']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @medium
|
||||||
|
*/
|
||||||
|
public function testTouchFloat() {
|
||||||
|
$storage = $this->getTestStorage(true, TemporaryNoTouch::class);
|
||||||
|
|
||||||
|
Filesystem::mount($storage, array(), '/');
|
||||||
|
|
||||||
|
$rootView = new View('');
|
||||||
|
$oldCachedData = $rootView->getFileInfo('foo.txt');
|
||||||
|
|
||||||
|
$rootView->touch('foo.txt', 500.5);
|
||||||
|
|
||||||
|
$cachedData = $rootView->getFileInfo('foo.txt');
|
||||||
|
$this->assertEquals(500, $cachedData['mtime']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue