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

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

geek-merlin created an issue. See original summary.

geek-merlin’s picture

What a nice issue ID.

geek-merlin’s picture

From https://drupal.stackexchange.com/a/289287:

/**
* 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.
*/

sjerdo’s picture

rosk0’s picture

I'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.

rosk0’s picture

To improve deployment identifier visibility I created small module Deployment identifier status. Leaving it here in case it would be useful to people.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

mxr576’s picture

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

cilefen’s picture

Does changing the identifier fix cases like #3492523: Class "Doctrine\Deprecations\Deprecation" not found, where a file tree relocates without namespace changes?

quietone’s picture

Issue summary: View changes
Issue tags: +Needs title update

Updated the IS.

What text do you want to add?

jastraat’s picture

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.

joachim’s picture

> 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.

longwave’s picture

As 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.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.