Skip to content

Commit e5cab66

Browse files
authored
[FEATURE] Cascade fe_group changes with extendToSubpages (reindex + cleanup)
### Summary When a parent page’s `fe_group` changes and `extendToSubpages=1` is set, access rules effectively change for descendants as well. This PR ensures the index reflects those changes by triggering subtree reindexing and removing stale access variants. ### What this PR does - Adds a `changeSet` wildcard (`'*'`) in `AbstractUpdateHandler` to match “any change” of a field, because `fe_group` diffs are non-trivial. - Introduces trigger `extendToSubpageEnabledAndFeGroupWasChanged` in `DataUpdateHandler` and `GarbageHandler`: - If `extendToSubpages=1` and `fe_group` changed → enqueue reindex for descendants (subtree) and clean up outdated access variants/documents. ### How to test 1) Create a small tree: parent **P** with `extendToSubpages=1`, children **C1/C2** inheriting access (no local `fe_group`). 2) Index once so all pages are present. 3) Change **P**’s `fe_group` (e.g., add/remove a frontend group). 4) Expected: subtree pages are queued for reindex; outdated access variants/documents are removed. (Before this PR: descendants did not reliably reindex; stale variants remained.) Fixes: #4399
1 parent 05f720a commit e5cab66

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Classes/Domain/Index/Queue/UpdateHandler/AbstractUpdateHandler.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,13 @@ protected function getAllChangeSetValuesMatch(array $triggerConfiguration, array
262262
return true;
263263
}
264264

265+
// Return true if triggerConfiguration field value is '*' and it's key is in changedFields array
266+
foreach ($triggerConfiguration['changeSet'] as $key => $value) {
267+
if ($value === '*' && array_key_exists($key, $changedFields)) {
268+
return true;
269+
}
270+
}
271+
265272
$diff = array_diff_assoc($triggerConfiguration['changeSet'], $changedFields);
266273
return empty($diff);
267274
}

Classes/Domain/Index/Queue/UpdateHandler/DataUpdateHandler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ class DataUpdateHandler extends AbstractUpdateHandler
9292
'no_search_sub_entriesFlagWasAdded' => [
9393
'changeSet' => ['no_search_sub_entries' => '0'],
9494
],
95+
// the current page has the field "extendToSubpages" enabled and the field "fe_group" was changed
96+
'extendToSubpageEnabledAndFeGroupWasChanged' => [
97+
'currentState' => ['extendToSubpages' => '1'],
98+
'changeSet' => ['fe_group' => '*'],
99+
],
95100
];
96101

97102
protected MountPagesUpdater $mountPageUpdater;

Classes/Domain/Index/Queue/UpdateHandler/GarbageHandler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ class GarbageHandler extends AbstractUpdateHandler
6464
'no_search_sub_entriesFlagWasAdded' => [
6565
'changeSet' => ['no_search_sub_entries' => '1'],
6666
],
67+
// the current page has the field "extendToSubpages" enabled and the field "fe_group" was changed
68+
'extendToSubpageEnabledAndFeGroupWasChanged' => [
69+
'currentState' => ['extendToSubpages' => '1'],
70+
'changeSet' => ['fe_group' => '*'],
71+
],
6772
];
6873

6974
/**

0 commit comments

Comments
 (0)