aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-11-28 17:13:43 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-12-04 19:14:51 +0000
commit46ed8cdfde60d046cbbb917f92f99a40546af7a6 (patch)
treec03c8d2839474c5a252bae4c952fd7b44b7246d3
parent5b8c2d62f1017021c8ef23ba06a0bf15724fb247 (diff)
downloadnextcloud-server-backport/49551/stable30.tar.gz
nextcloud-server-backport/49551/stable30.zip
fix: don't propagate future mtimesbackport/49551/stable30
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/Files/Cache/Propagator.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php
index bbeb8c42075..d04cc6e0364 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);
}
@@ -59,7 +64,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);
@@ -79,7 +86,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)) {