- Issue created by @catch
- π¬π§United Kingdom catch
I thought of some drawbacks when writing this up, but also a possibly solution in #3. So unless there's a fatal flaw in #3 I think we should do that.
- π·πΊRussia Chi
Is deployment_identifier changing if a site is reinstalled from configuration?
- π¬π§United Kingdom catch
@Chi no, it's based on whatever is set in settings.php or
\Drupal::VERSION
if nothing is set. - Status changed to Needs review
over 1 year ago 10:05am 3 July 2023 - last update
over 1 year ago Custom Commands Failed - Status changed to Needs work
over 1 year ago 10:46am 3 July 2023 The Needs Review Queue Bot β tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide β to find step-by-step guides for working with issues.
- Status changed to Closed: duplicate
over 1 year ago 11:41am 3 July 2023 - π¬π§United Kingdom catch
I don't think this is necessary with π Remove the aggregate stale file threshold and state entry Fixed so marking duplicate.
- πΊπΈUnited States scott_earnest
In our case, we wanted to use the deployment_identifier a little more aggressively, and ALWAYS use it (if set) on every asset. We were running into issues on the build where assets (css etc) were changed in a library whose version was NOT changed, causing the aggregated filename to not change - and would be cached on a CDN without the update to the style. We wanted all assets to be invalidated on every build, and controlled by the deployment_identifier which would change on each build.
The attached patch is another version of @catch 's patch (thank you) from #5. Instead of only using the deployment_identifer when the version is unset, this will use it on every asset. The fallback is the hash of the file contents (the base file has changed: AssetGroupSetHashTrait.php since other patch). Using a deployment_identifer should also decrease the expense of the build, since the system will never have to hash the contents of a file for the version.
PATCH TESTING
Setup
- Core aggregation (css an js) turned on
- Ensure caching is enabled
- Enable a module that has a "libraries.yml" file that includes an asset like CSS
- Set library version numeric e.g. "10.3.6", OR constant "VERSION"
- Look in the source for aggregated file(s), similar to:<link rel="stylesheet" media="all" href="/sites/default/files/css/css_hnAzTWJ78jrYDVrHTP6y05aGIS9LmOJ9kqQNNmNPny0.css?delta=0&language=en&theme=olivero&include=eJxdjEEOAyEMAz-0aJ-EArg0aiBVgkD8vj1RqTd7RrZvH2h3IselwhOmdxVNJMHHFu714LcuGEpIOyTR_DriAZRTsraGPvxqKExxcoHGxtm0aSG5fzEKJyNj-Bl3mlxpsPbgyNoL2T7SQZafYX0f_1knM10f_05QDA" /> <link rel="stylesheet" media="all" href="/sites/default/files/css/css_a1-EIU3hM01tk-bHNLV5AeTBWpvOtvaolQAlOLBNeD4.css?delta=1&language=en&theme=olivero&include=eJxdjEEOAyEMAz-0aJ-EArg0aiBVgkD8vj1RqTd7RrZvH2h3IselwhOmdxVNJMHHFu714LcuGEpIOyTR_DriAZRTsraGPvxqKExxcoHGxtm0aSG5fzEKJyNj-Bl3mlxpsPbgyNoL2T7SQZafYX0f_1knM10f_05QDA" />
- Note these file names, and when they change during the test
Without Patch
- Update library asset e.g. CSS, clear cache
- Aggregated filename does not changeWith Patch
- Update deployment_identifier, clear cache
- Aggregated filename changesPATCH FILE:
- 3371822-8-add-the-deploymentidentifier.patch β