hook_civicrm_entityTypes - Remove superfluous early-stage invocation
authorTim Otten <totten@civicrm.org>
Tue, 14 Jul 2020 10:13:19 +0000 (03:13 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 14 Jul 2020 10:21:58 +0000 (03:21 -0700)
commita7718acbe04134efd4f7b67626c44d17f26b2ead
tree080dee0b7218e5c1c95f959d3f74c5b53f00f7a0
parent2d198bb4d5065581108240bfd7e26b8ddf6807eb
hook_civicrm_entityTypes - Remove superfluous early-stage invocation

Before
------

TLDR: There are superfluous queries+hooks in every bootstrap. Specifically:

* During early stages of bootstrap, the extension system loads the `CRM_Extension_Manager_*` classes.
* The constructors for these classes lookup the option-group IDs in anticipation that they'll beeded.
* The lookup uses a helper method which relies on `hook_entityTypes`.
* Since all this happens during early bootstrap, `hook_entityTypes` becomes a preboot hook.
* But it's silly - because we don't actually these groupIds. They're only used during installation/uninstallation
  of obscure extensions.

After
-----

TLDR: Less superfluous queries+hooks.

* The `CRM_Extension_Manager_*` classes do not trigger any extraneous OG lookkups during bootstrap.
* The `CRM_Extension_Manager_*` will only do the query when it really needs to.
* `hook_entityTypes` fires later in bootstrap - when more services are available.
CRM/Extension/Manager/Report.php
CRM/Extension/Manager/Search.php