fix: make preload custom proterties sharding compatible

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/46639/head
Robin Appelman 1 year ago committed by Louis Chemineau
parent b21a399d1a
commit 1363e142d8
No known key found for this signature in database
  1. 18
      apps/dav/lib/DAV/CustomPropertiesBackend.php

@ -364,16 +364,16 @@ class CustomPropertiesBackend implements BackendInterface {
private function cacheDirectory(string $path, Directory $node): void {
$prefix = ltrim($path . '/', '/');
$query = $this->connection->getQueryBuilder();
$query->select('name', 'propertypath', 'propertyname', 'propertyvalue', 'valuetype')
$query->select('name', 'p.propertypath', 'p.propertyname', 'p.propertyvalue', 'p.valuetype')
->from('filecache', 'f')
->leftJoin('f', 'properties', 'p', $query->expr()->andX(
$query->expr()->eq('propertypath', $query->func()->concat(
$query->createNamedParameter($prefix),
'name'
)),
$query->expr()->eq('userid', $query->createNamedParameter($this->user->getUID()))
))
->where($query->expr()->eq('parent', $query->createNamedParameter($node->getInternalFileId(), IQueryBuilder::PARAM_INT)));
->hintShardKey('storage', $node->getNode()->getMountPoint()->getNumericStorageId())
->leftJoin('f', 'properties', 'p', $query->expr()->eq('p.propertypath', $query->func()->concat(
$query->createNamedParameter($prefix),
'f.name'
)),
)
->where($query->expr()->eq('parent', $query->createNamedParameter($node->getInternalFileId(), IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->eq('p.userid', $query->createNamedParameter($this->user->getUID())));
$result = $query->executeQuery();
$propsByPath = [];

Loading…
Cancel
Save