Cached environment indicator is never altered

Created on 1 August 2024, 4 months ago

In #2207897: Environment indicator cache is written on every request and uses altered version β†’ it was determined that caching the output of hook_environment_indicator_matched_indicator_alter() is undesirable. However, in environment_indicator_get_active(), condition #3 checks for a cached environment indicator and returns that without running the alter hook. Thus, any alters such as adding the git release are never added beyond the first uncached run (unless overwritten in settings.php via condition #2).

Possible resolutions:

  1. Call environment_indicator_alter_and_cache() in condition #3 (is consistent with other parts of the function that use the alter_and_cache call, at the expense of a frivolous cache_get)
  2. Call drupal_alter directly in condition #3
  3. Call drupal_alter before cache_set in environment_indicator_alter_and_cache(), partially undoing #2207897. You would then have to do a cache clear on each code deploy, which may or may not be standard for a given site's deployment process.

A related concern with options 1 and 2 is for sites that fall back to the git command instead of the remote_release variable, there would be performance hit of a proc call on every request. Perhaps that call should be cached for a limited period of time.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ChaseOnTheWeb USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024