|
|
|
|
@ -160,40 +160,45 @@ class Propagator implements IPropagator { |
|
|
|
|
} |
|
|
|
|
$this->inBatch = false; |
|
|
|
|
|
|
|
|
|
$this->connection->beginTransaction(); |
|
|
|
|
try { |
|
|
|
|
$this->connection->beginTransaction(); |
|
|
|
|
|
|
|
|
|
$query = $this->connection->getQueryBuilder(); |
|
|
|
|
$storageId = $this->storage->getCache()->getNumericStorageId(); |
|
|
|
|
$query = $this->connection->getQueryBuilder(); |
|
|
|
|
$storageId = $this->storage->getCache()->getNumericStorageId(); |
|
|
|
|
|
|
|
|
|
$query->update('filecache') |
|
|
|
|
->set('mtime', $query->func()->greatest('mtime', $query->createParameter('time'))) |
|
|
|
|
->set('etag', $query->expr()->literal(uniqid())) |
|
|
|
|
->where($query->expr()->eq('storage', $query->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) |
|
|
|
|
->andWhere($query->expr()->eq('path_hash', $query->createParameter('hash'))); |
|
|
|
|
$query->update('filecache') |
|
|
|
|
->set('mtime', $query->func()->greatest('mtime', $query->createParameter('time'))) |
|
|
|
|
->set('etag', $query->expr()->literal(uniqid())) |
|
|
|
|
->where($query->expr()->eq('storage', $query->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) |
|
|
|
|
->andWhere($query->expr()->eq('path_hash', $query->createParameter('hash'))); |
|
|
|
|
|
|
|
|
|
$sizeQuery = $this->connection->getQueryBuilder(); |
|
|
|
|
$sizeQuery->update('filecache') |
|
|
|
|
->set('size', $sizeQuery->func()->add('size', $sizeQuery->createParameter('size'))) |
|
|
|
|
->where($query->expr()->eq('storage', $sizeQuery->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) |
|
|
|
|
->andWhere($query->expr()->eq('path_hash', $sizeQuery->createParameter('hash'))) |
|
|
|
|
->andWhere($sizeQuery->expr()->gt('size', $sizeQuery->createNamedParameter(-1, IQueryBuilder::PARAM_INT))); |
|
|
|
|
$sizeQuery = $this->connection->getQueryBuilder(); |
|
|
|
|
$sizeQuery->update('filecache') |
|
|
|
|
->set('size', $sizeQuery->func()->add('size', $sizeQuery->createParameter('size'))) |
|
|
|
|
->where($query->expr()->eq('storage', $sizeQuery->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) |
|
|
|
|
->andWhere($query->expr()->eq('path_hash', $sizeQuery->createParameter('hash'))) |
|
|
|
|
->andWhere($sizeQuery->expr()->gt('size', $sizeQuery->createNamedParameter(-1, IQueryBuilder::PARAM_INT))); |
|
|
|
|
|
|
|
|
|
foreach ($this->batch as $item) { |
|
|
|
|
$query->setParameter('time', $item['time'], IQueryBuilder::PARAM_INT); |
|
|
|
|
$query->setParameter('hash', $item['hash']); |
|
|
|
|
foreach ($this->batch as $item) { |
|
|
|
|
$query->setParameter('time', $item['time'], IQueryBuilder::PARAM_INT); |
|
|
|
|
$query->setParameter('hash', $item['hash']); |
|
|
|
|
|
|
|
|
|
$query->executeStatement(); |
|
|
|
|
$query->executeStatement(); |
|
|
|
|
|
|
|
|
|
if ($item['size']) { |
|
|
|
|
$sizeQuery->setParameter('size', $item['size'], IQueryBuilder::PARAM_INT); |
|
|
|
|
$sizeQuery->setParameter('hash', $item['hash']); |
|
|
|
|
if ($item['size']) { |
|
|
|
|
$sizeQuery->setParameter('size', $item['size'], IQueryBuilder::PARAM_INT); |
|
|
|
|
$sizeQuery->setParameter('hash', $item['hash']); |
|
|
|
|
|
|
|
|
|
$sizeQuery->executeStatement(); |
|
|
|
|
$sizeQuery->executeStatement(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->batch = []; |
|
|
|
|
$this->batch = []; |
|
|
|
|
|
|
|
|
|
$this->connection->commit(); |
|
|
|
|
$this->connection->commit(); |
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
$this->connection->rollback(); |
|
|
|
|
throw $e; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|