diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-12-04 20:11:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-04 20:11:23 +0100 |
commit | b4c43bb811407aeaf70f6df6cd1674eb27eaa734 (patch) | |
tree | bc59db38177c2c5f49843cfc4f086a74c41baa41 /lib | |
parent | 0e10bb59a196af4b75cbd5a4ef786be059d97b29 (diff) | |
parent | aadfcb3fe693f5511cb4e8b24ce3f89a99a0e8a7 (diff) | |
download | nextcloud-server-b4c43bb811407aeaf70f6df6cd1674eb27eaa734.tar.gz nextcloud-server-b4c43bb811407aeaf70f6df6cd1674eb27eaa734.zip |
Merge pull request #49551 from nextcloud/dont-propagate-future-time
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Cache/Propagator.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index cdf9ca9991a..a6ba87896f4 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -13,6 +13,8 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Cache\IPropagator; use OCP\Files\Storage\IReliableEtagStorage; use OCP\IDBConnection; +use OCP\Server; +use Psr\Clock\ClockInterface; use Psr\Log\LoggerInterface; /** @@ -39,10 +41,13 @@ class Propagator implements IPropagator { */ private $ignore = []; + private ClockInterface $clock; + public function __construct(\OC\Files\Storage\Storage $storage, IDBConnection $connection, array $ignore = []) { $this->storage = $storage; $this->connection = $connection; $this->ignore = $ignore; + $this->clock = Server::get(ClockInterface::class); } /** @@ -58,7 +63,9 @@ class Propagator implements IPropagator { } } - $storageId = (int)$this->storage->getStorageCache()->getNumericId(); + $time = min((int)$time, $this->clock->now()->getTimestamp()); + + $storageId = $this->storage->getStorageCache()->getNumericId(); $parents = $this->getParents($internalPath); @@ -78,7 +85,7 @@ class Propagator implements IPropagator { }, $parentHashes); $builder->update('filecache') - ->set('mtime', $builder->func()->greatest('mtime', $builder->createNamedParameter((int)$time, IQueryBuilder::PARAM_INT))) + ->set('mtime', $builder->func()->greatest('mtime', $builder->createNamedParameter($time, IQueryBuilder::PARAM_INT))) ->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) ->andWhere($builder->expr()->in('path_hash', $hashParams)); if (!$this->storage->instanceOfStorage(IReliableEtagStorage::class)) { |