Problem/Motivation
$settings['deployment_identifier'] is hardly known nor documented.
Despite the fact that moving classes may bring you in a situation where you beter know about this:
# settings.php
$settings['deployment_identifier'] = 'something different';
I couldn not even simply find the place where it was invented.
The deployment_identifier was added in #2507509: Service changes should not result in fatal errors between patch or minor releases, in Jun 2015. As of Nov 2023, #3379819: Display the deployment_identifier on the status page it is listed on the Status page.
Steps to reproduce
Proposed resolution
Document this by adding a deployment example script that includes creating this.
Current text in default.settings.php
/**
* Deployment identifier.
*
* Drupal's dependency injection container will be automatically invalidated and
* rebuilt when the Drupal core version changes. When updating contributed or
* custom code that changes the container, changing this identifier will also
* allow the container to be invalidated as soon as code is deployed.
*/
# $settings['deployment_identifier'] = \Drupal::VERSION;
Proposed text
TBA
Remaining tasks
Add text/instructions
Comments
Comment #2
geek-merlinWhat a nice issue ID.
Comment #3
geek-merlinFrom https://drupal.stackexchange.com/a/289287:
Comment #4
sjerdoComment #5
rosk0I'm curious why people say that it's not documented if the usage is perfectly described here https://git.drupalcode.org/project/drupal/-/blob/9.1.x/sites/default/def... and it was there since 8.0 as properly pointed out by #4.
I think usage would be very different depending on the hosting environment. Pantheon already provides this by default from what I can see in #2752961-49: No reliable method exists for clearing the Twig cache.
Comment #6
rosk0To improve deployment identifier visibility I created small module Deployment identifier status. Leaving it here in case it would be useful to people.
Comment #8
mxr576Comment #14
quietone commentedThe deployment_identifier was adding in #2507509: Service changes should not result in fatal errors between patch or minor releases, it started in this comment, #2507509-16: Service changes should not result in fatal errors between patch or minor releases
Does anyone have suggested wording to add?
Comment #15
cilefen commentedDoes changing the identifier fix cases like #3492523: Class "Doctrine\Deprecations\Deprecation" not found, where a file tree relocates without namespace changes?
Comment #16
quietone commentedUpdated the IS.
What text do you want to add?
Comment #17
jastraat commentedI'd like to see an example of what the value for the identifier might be if the update was not related to a core Drupal update.
Comment #18
joachim commented> Document this by adding a deployment example script that includes creating this.
I'm not sure what that would look like.
> I'd like to see an example of what the value for the identifier might be if the update was not related to a core Drupal update.
Agreed, I think it would be worth explicitly saying that the value is arbitrary and that all that matters is that it is changed.
Comment #19
longwaveAs per #3492523-40: Class "Doctrine\Deprecations\Deprecation" not found while this does automatically invalidate the container, I'm not convinced that it affects the autoloader.