mirror of
https://github.com/netzbegruenung/groupfolders.git
synced 2024-05-04 18:33:45 +02:00
Increase performance by selecting on indexed column
This commit is contained in:
parent
045577176e
commit
a3e1b73830
|
@ -93,11 +93,15 @@ class RuleManager {
|
|||
public function getRulesForFilesByPath(IUser $user, int $storageId, array $filePaths): array {
|
||||
$userMappings = $this->userMappingManager->getMappingsForUser($user);
|
||||
|
||||
$hashes = array_map(function (string $path) {
|
||||
return md5($path);
|
||||
}, $filePaths);
|
||||
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->select(['f.fileid', 'mapping_type', 'mapping_id', 'mask', 'a.permissions', 'path'])
|
||||
->from('group_folders_acl', 'a')
|
||||
->innerJoin('a', 'filecache', 'f', $query->expr()->eq('f.fileid', 'a.fileid'))
|
||||
->where($query->expr()->in('path', $query->createNamedParameter($filePaths, IQueryBuilder::PARAM_STR_ARRAY)))
|
||||
->where($query->expr()->in('path_hash', $query->createNamedParameter($hashes, IQueryBuilder::PARAM_STR_ARRAY)))
|
||||
->andWhere($query->expr()->eq('storage', $query->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($query->expr()->orX(...array_map(function (IUserMapping $userMapping) use ($query) {
|
||||
return $query->expr()->andX(
|
||||
|
|
Loading…
Reference in a new issue