dev/core#5714 Ensure that Standalone sites do not crash when in multi… #32442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…lingual mode when setting the timezone
Overview
This fixes the hard crashed caused when enabling mutlingual mode in standalone
Before
Site hard crashes because we try to use APIv4 to look up User record before the locale has been applied
After
Site doesn't hard crash as we defer to using direct SQL to retrieve this one piece of information from the user (uf_match) table
Technical Details
The GenericDAOAction in preparing for the APIv4 triggers the looking up of OptionsCallbacks such as https://github.com/civicrm/civicrm-core/blob/master/Civi/Api4/Generic/AbstractAction.php#L59
This tries to load language options out of the civicrm_option_value table https://github.com/civicrm/civicrm-core/blob/master/Civi/Api4/Generic/AbstractAction.php#L597 but as $dbLocale has not yet been set properly a hard fail is triggered after enabling multilingual.
This sidesteps using APIv4 in this immediate postBoot prior to locale being set scenario to just use a direct SQL query to get the timezone out of the uf_match table. The uf_match table isn't involved in any multilingual setup
ping @ufundo @mlutfy @totten