Postponed on #2941757: Extension System, Part IV: Properly register all installed extensions/namespaces during container generation.

Cache backends are now defined in the DIC.

To have something available in the DIC as a service, it needs to be registered in a services.yml

Only modules can provide services.yml

Previously, you could enable memcache (or another session/cache/lock/queue backend) entirely via settings.php without having to enable a module at all. Now the service would have to be defined services.yml in memcache module, then settings.php could do the rest.

This affects both large multi-sites where you want to configure every site to use memcache just once (via a shared settings.php or whatever), and also potentially dev/staging where services might want to be different based on the environment.
Not sure what to do about this, when discussing with Damian we thought about sites/*/services.yml (and/or allow settings.php to specify a file location).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip’s picture

So the main problem is that we can't register any namespaces here, so adding stuff to the container will not help.

The code in DrupalKernel::discoverServiceProviders() currently allows to add service providers and yaml files when the container is getting built. So for instance, we could create a ServiceProvider and load that, but we need more to use something like a cache backend in the DIC.

sdboyer’s picture

sites/*/services.yml jumps out as the simplest, sanest approach to me - it sticks with the yml-based approach, and is situated at a level on the filesystem that makes it clear that its logical container is a site.

problem with it is that it's not easy to expand that into something which varies by env (unless you're capturing different environments via multisite, aka DOING IT RONG).

hmm...i'll ponder a bit on that.

damiankloip’s picture

Status: Active » Needs review
FileSize
774 bytes

#2, we can already add serviceProviders/yaml providers from settings.php to get included when the container is built.

ok, so as mentioned in #1, I think what we really need to tackle is being able to add namespace prefixes from settings.php. The rest I think we can deal with, as we can either add a service provider class or a Yaml services file in settings.php. As long as we have namespaces, we can load the services we need.

Depending on which issues lands first, this or #2060571: Inject Settings class into DrupalKernel, this should be converted to use Settings() instead of $GLOBALS.

damiankloip’s picture

Issue summary: View changes
FileSize
1.47 KB
1.44 KB

ok, speaking to msonnabaum on IRC for a bit; Let's just use settings in the kernel, injecting it is probably not needed. atleast not an this stage.

Added a settings method to DrupalKernel, this just returns Settings::getSingleton(), then if we need to change anything later, none of this code needs to change.

Status: Needs review » Needs work

The last submitted patch, 4: 2044137-4.patch, failed testing.

damiankloip’s picture

4: 2044137-4.patch queued for re-testing.

damiankloip’s picture

Status: Needs work » Needs review
Anonymous’s picture

nice. do we need anything else to RTBC this?

damiankloip’s picture

Status: Needs review » Postponed

I think just maybe a test for this really.

Seems like it might be a good idea to wait for #2021959: Refactor module handling responsibilities out of DrupalKernel, then continue with this. As testing etc... should be easier then anyway.

mgifford’s picture

Looks like this may have hit a serious snag and have to be redone #2021959-36: Refactor module handling responsibilities out of DrupalKernel

chx’s picture

Isn't this solved with sites/default/services.yml introduced?

Berdir’s picture

You still need to have the module enabled for the namespace to be loaded. This issue adds a workaround for that.

However, I don't really see the problem of having to enable a module. Cache backend modules have always been very weird in the way they work and different from all other modules, so why not just live with it?

dawehner’s picture

I agree with berdir, running code which is not supposed to be run originally can lead to all kind of weird sideeffects so we better don't support it in the first place?

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

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

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
quietone’s picture

Issue summary: View changes

This was postponed on an issue that was closed as a duplicate of #2941757: Extension System, Part IV: Properly register all installed extensions/namespaces during container generation, so it is now postponed on that.

Berdir’s picture

Status: Postponed » Closed (outdated)

Nobody seems to disagree with my comment from 2014, so lets see if someone disagrees with closing this.

Note: You technically can do this now, you can add to the classloader directly to load code from a module and that is done for the bootstrap container definition for example which is possible to put in redis.

See #3007374: Document bootstrap_container_definition in README and #2644450: Document bootstrap_container_definition for issues on documenting that.