Skip to content

Commit

Permalink
Merge branch '4.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
micszo committed Mar 8, 2024
2 parents 5281359 + 4875dea commit 7b326a0
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 7 deletions.
2 changes: 1 addition & 1 deletion features/setup/multirepository/multirepository.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: Multirepository setup for testing

@multirepository
@multirepository
Scenario: Set up new repository and make the default one unaccessible
Given I set configuration to "doctrine.dbal" in "config/packages/doctrine.yaml"
"""
Expand Down
17 changes: 17 additions & 0 deletions features/setup/multirepository/multirepository_elastic.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: Multirepository setup for testing with Elastic

@elastic
Scenario: Set up new connection and make the default one unaccessible
Given I append configuration to "parameters" in "config/packages/ibexa_elasticsearch.yaml"
"""
elasticsearch_dsn_invalid: "INVALID"
"""
And I set configuration to "ibexa_elasticsearch.connections" in "config/packages/ibexa_elasticsearch.yaml"
"""
default:
hosts:
- "%elasticsearch_dsn_invalid%"
second_connection:
hosts:
- "%elasticsearch_dsn%"
"""
30 changes: 30 additions & 0 deletions features/setup/multirepository/multirepository_solr.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Feature: Multirepository setup for testing with Solr

@solr
Scenario: Set up new connection and make the default one unaccessible
Given I append configuration to "parameters" in "config/packages/ibexa_solr.yaml"
"""
solr_dsn_invalid: 'INVALID'
solr_core_invalid: 'INVALID'
"""
And I set configuration to "ibexa_solr" in "config/packages/ibexa_solr.yaml"
"""
endpoints:
endpoint0:
dsn: '%solr_dsn%'
core: '%solr_core%'
endpoint1_invalid:
dsn: '%solr_dsn_invalid%'
core: '%solr_core_invalid%'
connections:
default:
entry_endpoints:
- endpoint1_invalid
mapping:
default: endpoint1_invalid
second_connection:
entry_endpoints:
- endpoint0
mapping:
default: endpoint0
"""
18 changes: 12 additions & 6 deletions src/lib/API/Facade/UserFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,21 @@ private function loadLegacyUserGroupByName(string $userGroupName): UserGroup
new Criterion\ContentTypeIdentifier(self::USERGROUP_CONTENT_IDENTIFIER),
]);

$result = $this->searchService->findContent($query);
$iteration_count = 5;

while ($iteration_count > 0) {
$result = $this->searchService->findContent($query);

foreach ($result->searchHits as $searchHit) {
/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */
$content = $searchHit->valueObject;
foreach ($result->searchHits as $searchHit) {
/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */
$content = $searchHit->valueObject;

if ($content->contentInfo->name === $userGroupName) {
return $this->userService->loadUserGroup($content->contentInfo->id);
if ($content->contentInfo->name === $userGroupName) {
return $this->userService->loadUserGroup($content->contentInfo->id);
}
}
usleep(500000);
--$iteration_count;
}

throw new NotFoundException('User Group', $userGroupName);
Expand Down

0 comments on commit 7b326a0

Please sign in to comment.