Skip to content

[main] Fix(Core): Optimize containers tabs computation when many entities are active - #1365

Merged
MyvTsv merged 1 commit into
mainfrom
forward-port/1348-to-main
Dec 2, 2026
Merged

MyvTsv merged 1 commit into
mainfrom
forward-port/1348-to-main

Conversation

@glpi-project

@glpi-project glpi-project Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Forward-port of #1348 to main.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.

Description

Changes:

  • entity visibility is computed once per entity (containers usually share a few entities), with a key-based intersection;
  • the rights of the active profile on all entity-visible containers are read in a single query, with the new PluginFieldsProfile::getRightsOnContainers();
  • PluginFieldsProfile::getRightOnContainer() now relies on getRightsOnContainers(), so the rights query exists only once.

The behaviour is unchanged: same entity rule, same MAX(right) per container and profile, a container without right (no row, NULL or 0) is still skipped, and the cron / no active profile cases still return no entry.

On an instance with 22 containers on the root entity and 5591 entities, getEntries() goes from about 47 ms to about 2 ms, with identical results for 39 user/profile combinations and for getRightOnContainer() on 700 profile × container pairs.

New tests in tests/Units/ContainerGetEntriesTest.php cover profile rights (none, read, create), recursive and non recursive containers seen from a child entity, the no active profile case, and the equivalence of getRightsOnContainers() with getRightOnContainer().

@glpi-project

glpi-project Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin forward-port/1348-to-main
git worktree add --checkout .worktree/forward-port/1348-to-main forward-port/1348-to-main
cd .worktree/forward-port/1348-to-main
git reset --hard HEAD^
git cherry-pick -x cacf687f7511a08abaa7cffbe41977b86e96173e

@Rom1-B Rom1-B self-assigned this Dec 1, 2026
@Rom1-B
Rom1-B marked this pull request as ready for review December 1, 2026 13:35
@Rom1-B
Rom1-B force-pushed the forward-port/1348-to-main branch from ce8f0d8 to e5d9a03 Compare December 1, 2026 13:35
Rom1-B
Rom1-B previously approved these changes Dec 1, 2026
@Rom1-B
Rom1-B force-pushed the forward-port/1348-to-main branch from e5d9a03 to 13fe320 Compare December 1, 2026 13:39
@Rom1-B
Rom1-B requested review from a team, Mary-Clb, MyvTsv and RomainLvr and removed request for a team December 1, 2026 13:44
@MyvTsv
MyvTsv merged commit e00c7e3 into main Dec 2, 2026
7 checks passed
@MyvTsv
MyvTsv deleted the forward-port/1348-to-main branch December 2, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slow page loads with many entities: getEntries() checks entities and rights container by container on every request

3 participants