Problem/Motivation

We have DRUPAL_ROOT, a global constant. Global constants are global variables. That is, they complect anything they touch with the environment. It's an implicit dependency that you cannot override, inject, or otherwise reason about.

Proposed resolution

We now have the app.root container property, which has the same value. Use it!

A passed parameter is better than a global constant for all the same reasons that an injected service is better than a global function (or static method). It's an explicit, mockable, controllable dependency we can reason about rather than a stealth dependency and ticking time bomb.

Remaining tasks

Commit the current patch.

User interface changes

None.

API changes

Implicitly DRUPAL_ROOT is deprecated, but that wasn't introduced by this issue.

CommentFileSizeAuthor
#100 interdiff.txt746 bytesdawehner
#100 2328111-100.patch137.19 KBdawehner
#97 2328111-97.patch137.08 KBdawehner
#94 interdiff.txt10.65 KBdawehner
#94 2328111-94.patch137.17 KBdawehner
#91 2328111-91.patch137.94 KBdawehner
#90 interdiff.txt1.47 KBdawehner
#90 2328111-90.patch137.94 KBdawehner
#88 interdiff.txt7.53 KBdawehner
#88 2328111-88.patch136.68 KBdawehner
#84 interdiff-82-84.txt509 bytesmartin107
#84 root-2328111-84.patch129.34 KBmartin107
#82 interdiff-80-82.txt3.31 KBmartin107
#82 root-2328111-82.patch129.07 KBmartin107
#80 interdiff-78-80.txt1.06 KBmartin107
#80 root-2328111-80.patch127.31 KBmartin107
#78 2328111-78.patch127.32 KBdawehner
#74 interdiff.txt2.6 KBdawehner
#74 root-2328111-74.patch126.91 KBdawehner
#72 interdiff.txt7.43 KBdawehner
#72 drupal_root-2328111-72.patch127.11 KBdawehner
#68 interdiff.txt496 bytesdawehner
#68 2328111-68.patch126.42 KBdawehner
#66 interdiff.txt1.64 KBdawehner
#66 2328111-66.patch126.66 KBdawehner
#62 drupal_root-2328111-62.patch125.06 KBmartin107
#60 2328111-60.patch124.96 KBdawehner
#59 drupal_root-2328111-58.patch124.75 KBdawehner
#56 interdiff.txt6.12 KBdawehner
#54 interdiff.txt2.54 KBdawehner
#52 drupal_root-2328111-52.patch124.87 KBdawehner
#50 drupal_root-2328111-50.patch124.88 KBdawehner
#46 drupal_root-2328111-46.patch122.97 KBdawehner
#44 drupal_root-2328111-44.patch123.11 KBdawehner
#37 drupal_root-2328111-37.patch123 KBdawehner
#34 interdiff.txt4.11 KBdawehner
#34 drupal_root-2328111-34.patch122.73 KBdawehner
#32 interdiff.txt58.61 KBdawehner
#32 drupal_root-2328111-32.patch123.28 KBdawehner
#30 drupal_root-2328111-30.patch71.06 KBdawehner
#28 drupal_root-2328111-28.patch70.37 KBdawehner
#25 drupal_root-2328111-25.patch71.79 KBneclimdul
#25 drupal_root-2328111-25.interdiff.txt7.42 KBneclimdul
#22 roo.jpg16.35 KBtstoeckler
#20 interdiff.txt694 bytesdawehner
#20 drupal_root-2328111-20.patch70.01 KBdawehner
#18 drupal_root-2328111-18.patch70.01 KBdawehner
#14 interdiff.txt995 bytesdawehner
#14 drupal_root-2328111-14.patch66.88 KBdawehner
#12 interdiff.txt3.41 KBdawehner
#12 drupal_root-2328111-12.patch65.91 KBdawehner
#10 interdiff.txt4.79 KBdawehner
#10 drupal_root-2328111-10.patch64.02 KBdawehner
#3 app_root-2328111-3.patch63.74 KBdawehner
#1 drupal_root-2270323-8.patch46.36 KBdawehner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
46.36 KB

First version...

Status: Needs review » Needs work

The last submitted patch, 1: drupal_root-2270323-8.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
63.74 KB

Some work.

Status: Needs review » Needs work

The last submitted patch, 3: app_root-2328111-3.patch, failed testing.

sun’s picture

@msonnabaum, @neclimdul, @Crell, and I already had some discussions on the topic of how to handle DRUPAL_ROOT, in particular for unit tests. One affected issue was #2246611: Document ModuleHandler pre-conditions

We discussed a constructor injection approach (like here), but further discussion made us prefer a getAppRoot() method that defaults to DRUPAL_ROOT but can be cleanly overridden in test stubs. Unfortunately, I don't remember what made us arrive at that conclusion, but IIRC, @msonnabaum raised some legit concerns against constructor injection (or perhaps someone else, dunno).

I think that could use some more discussion (→ plan) before investing a lot of work here, so as to ensure that the proposed solution is the desired + sustainable solution.


In any case, I don't really see the point of \Drupal::root() and would rather prefer to omit that here. I don't think we're able to remove the DRUPAL_ROOT constant anyway, since a lot of other code depends on it.

dawehner’s picture

  • If you use CI you make the dependency really clear
  • It is really easy to override id for testing purposes
  • Even if it global state, it doesn't need to be. It blocks you to write generic components, so making the dependency explicit via the constructor is a good idea, if you ask me
  • There is a huge advantage that this "state" was moved to the container, so it can be used everywhere.
Crell’s picture

To the extent possible I fully support this. I don't think that the extent possible will be 100%, but that doesn't mean we shouldn't do the parts we can. Constructor injection for this is the ideal if we can make it work in a given context.

That said, there's probably a lot of places we're using DRUPAL_ROOT where we arguably don't even need it. That would be even better. :-)

neclimdul’s picture

What Crell said.

dawehner’s picture

Status: Needs work » Needs review
FileSize
64.02 KB
4.79 KB

The places where we cannot use it is mostly the installer and the kernel and testing, but for sure with this patch, these spaces are actually exposed properly.

Note: For example Settings::initialize() could be free from the root, if we decide to pass in an absolute path.

Status: Needs review » Needs work

The last submitted patch, 10: drupal_root-2328111-10.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
65.91 KB
3.41 KB

Fixed a couple of instances.

Status: Needs review » Needs work

The last submitted patch, 12: drupal_root-2328111-12.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
66.88 KB
995 bytes

Back to green.

dawehner’s picture

Added a change record, even this is not actually caused by this issue.

Crell’s picture

Status: Needs review » Reviewed & tested by the community

This doesn't get every instance of DRUPAL_ROOT, but it looks like it gets most of 'em. It's also still a digestable patch size. I therefore think we should go ahead with it. If we are able to convert anything else later we can do so.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 14: drupal_root-2328111-14.patch, failed testing.

dawehner’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
70.01 KB

Reroll.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 18: drupal_root-2328111-18.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
70.01 KB
694 bytes

Okay it is getting late.

Crell’s picture

Status: Needs review » Reviewed & tested by the community

I've so been there... :-)

tstoeckler’s picture

FileSize
16.35 KB

Hmm... I actually like #18 better. I think every app should have a roo!

(Sorry, couldn't resist.)

cosmicdreams’s picture

Tried to apply patch and it failed in the following files:

core/includes/bootstrap.inc
core/includes/install.core.inc
core/lib/Drupal/Core/DrupalKernel.php
core/lib/Drupal/Core/Site/Settings.php
core/modules/simpletest/src/InstallerTestBase.php
core/modules/simpletest/src/WebTestBase.php
core/rebuild.php

Patch likely was impacted by #2325197: Remove drupal_classloader()

cosmicdreams’s picture

Status: Reviewed & tested by the community » Needs work
neclimdul’s picture

Status: Needs work » Needs review
FileSize
7.42 KB
71.79 KB

Not an "easy" reroll but not t0o bad. Lots off conflicts because of the addition of a classloader to the settings init which had to manually be resolved. Details in the interdiff. Not really comfortable with that change but I missed the issue so to the follow up I'll go.

Crell’s picture

Status: Needs review » Reviewed & tested by the community

Silly fast-moving core...

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 25: drupal_root-2328111-25.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
70.37 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 28: drupal_root-2328111-28.patch, failed testing.

dawehner’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
71.06 KB
alexpott’s picture

We've gone from 248 to 201 instances of DRUPAL_ROOT so

This doesn't get every instance of DRUPAL_ROOT, but it looks like it gets most of 'em.

And the issue title is a bit disingenuous.

I'm happy to do this replacement in several steps but let's have an honest title and followups to replace the other 200 DRUPAL_ROOT instances. I have no idea why we've converted what we've converted in this patch and why we've added additional usages of DRUPAL_ROOT

+++ b/core/modules/simpletest/src/TestDiscovery.php
@@ -437,7 +437,7 @@ public static function parseTestClassAnnotations(\ReflectionClass $class) {
+    $listing = new ExtensionDiscovery(DRUPAL_ROOT);

+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -862,14 +862,14 @@ protected function setUp() {
+    Settings::initialize(DRUPAL_ROOT, $directory, $class_loader);
...
+    Settings::initialize(DRUPAL_ROOT, $directory, $class_loader);

For example

dawehner’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
123.28 KB
58.61 KB

Let's see how much fails. After that there are just 104 left.

Status: Needs review » Needs work

The last submitted patch, 32: drupal_root-2328111-32.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
122.73 KB
4.11 KB

Okay, let's get back to fix the failures.

Crell’s picture

Title: Replace each instance of the DRUPAL_ROOT constant with the app.root container parameter » Replace most instances of the DRUPAL_ROOT constant with the app.root container parameter
Status: Needs review » Reviewed & tested by the community

Retitling to be more accurate. (104 left means more than half are replaced here, which qualifies for "most".)

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll
git ac https://www.drupal.org/files/issues/drupal_root-2328111-34.patch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  122k  100  122k    0     0  53564      0  0:00:02  0:00:02 --:--:-- 64681
error: patch failed: core/core.services.yml:275
error: core/core.services.yml: patch does not apply
error: patch failed: core/modules/system/src/Controller/DbUpdateController.php:61
error: core/modules/system/src/Controller/DbUpdateController.php: patch does not apply
error: patch failed: core/modules/user/src/Tests/UserAccountFormFieldsTest.php:29
error: core/modules/user/src/Tests/UserAccountFormFieldsTest.php: patch does not apply
error: patch failed: core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php:167
error: core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php: patch does not apply
dawehner’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
123 KB

There we go.

moshe weitzman’s picture

IMO the motivation section of the IS needs work. I don't know whats ugly about DRUPAL_ROOT. Seems pretty straightforward to me. I see it replaced with various things like $this->root, \Drupal::root(), app.root. Those aren't too bad either - just want to know whats wrong here.

Crell’s picture

moshe: Global constants are global variables. Aka, complecting with the environment. Aka the class will fatal if that's not defined, as opposed to will not instantiate without an obvious constructor parameter. That is what "ugly" means in this context.

dawehner’s picture

This is about making it clear about the dependencies of these classes.

alexpott’s picture

So lets update the summary and be explicit about what we mean by ugliness then.

Crell’s picture

Issue summary: View changes
Issue tags: -WSCCI, -Needs issue summary update

Defining ugly.

(Also this isn't really WSCCI, just general good architecture.)

catch’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php
@@ -355,7 +365,7 @@ public function disable(array $theme_list) {
+    if (TRUE || !isset($this->list)) {
dawehner’s picture

Status: Needs work » Needs review
FileSize
123.11 KB

Good review and embarrassing! I was probably in the middle of debugging something unrelated.

Status: Needs review » Needs work

The last submitted patch, 44: drupal_root-2328111-44.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
122.97 KB

Forgot one merge conflict.

Crell’s picture

Status: Needs review » Reviewed & tested by the community
catch’s picture

Status: Reviewed & tested by the community » Needs review

app.root is stored on the container.

The container is stored in phpstorage. This massively changes the semantics compared to DRUPAL_ROOT which is guaranteed to be correct each request, now it can get stale.

If I copy or move my Drupal install to a different directory, what happens?

Moving - won't it fatal and require rebuild.php? (not too bad)

Copying - won't it start including files from the wrong directory? (this seems like the potential for all kinds of fun debugging situations).

ParisLiakos’s picture

thats true for d7 too..move files..you get all kind of weird stuff until you run drush rr. i dont see the problem

dawehner’s picture

FileSize
124.88 KB

An alternative approach would be to construct this on runtime.

Status: Needs review » Needs work

The last submitted patch, 50: drupal_root-2328111-50.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
124.87 KB

Rerolled.

Crell’s picture

Interdiff please?

dawehner’s picture

FileSize
2.54 KB

Here it is. This is btw. a usecase you could use expression language for.

Crell’s picture

I was referring more to an interdiff for #20, with the runtime approach.

dawehner’s picture

FileSize
6.12 KB

OH sure, this is a completely different file, maybe this one?

Status: Needs review » Needs work

The last submitted patch, 52: drupal_root-2328111-52.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
124.75 KB

Reroll

dawehner’s picture

FileSize
124.96 KB

Reroll.

Status: Needs review » Needs work

The last submitted patch, 60: 2328111-60.patch, failed testing.

martin107’s picture

Status: Needs work » Needs review
FileSize
125.06 KB

When I rewound head to October 10, 2014 at 8:11pm and applied the patch from #60, it failed .. I am assuming other commits about that time invalidated the reroll...

So I rerolled from #59

dawehner’s picture

Awesome martin!

We sadly need another proper review, given that bits of the actual architecture changed in the meantime.

Status: Needs review » Needs work

The last submitted patch, 62: drupal_root-2328111-62.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
126.66 KB
1.64 KB

Another reroll.

neclimdul’s picture

Not a real review but

+++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php
@@ -108,6 +108,7 @@ class ThemeHandler implements ThemeHandlerInterface {
+<<<<<<< ours

Oops

dawehner’s picture

FileSize
126.42 KB
496 bytes

/me hides

penyaskito’s picture

+++ b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
@@ -125,8 +125,8 @@ protected function setUp() {
+    $root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));

+++ b/core/tests/Drupal/Tests/Core/Form/FormTestBase.php
@@ -160,6 +167,7 @@ protected function setUp() {
+    $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));

--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTest.php

+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTest.php
@@ -50,6 +57,8 @@ protected function setUp() {
+    $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
+    $container->setParameter('app.root', $this->root);

I don't have a concrete proposal but... is there nothing more readable?

If this is absolutely necessary, can it be moved to the parent class avoiding repetition?

dawehner’s picture

If this is absolutely necessary, can it be moved to the parent class avoiding repetition?

Just to be clear, this is a unit test ... so nothing you would ever need in production.

penyaskito’s picture

I know... but we want people to write unit tests :-)

I am sure people will start by copypasting core ones, and it can be difficult to realize that 99% cases need to replace

$this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));

with

$this->root = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__)));

if they put their modules on DRUPAL_ROOT/modules

dawehner’s picture

FileSize
127.11 KB
7.43 KB

Sure, let's do it.

penyaskito’s picture

  1. +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
    +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
    @@ -33,13 +33,22 @@ class ModuleHandlerTest extends UnitTestCase {
    
    @@ -505,6 +516,7 @@ public function dependencyProvider() {
    +    $root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
    +    $this->assertEquals(array('module' => $root . '/place'), $this->moduleHandler->getModuleDirectories());
       }
    

    This could use $this->root now I think.

  2. +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
    --- a/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
    +++ b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
    
    +++ b/core/tests/Drupal/Tests/Core/Form/FormCacheTest.php
    @@ -125,8 +125,8 @@ protected function setUp() {
    +    $root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
    +    $this->formCache = new FormCache($root, $this->keyValueExpirableFactory, $this->moduleHandler, $this->account, $this->csrfToken, $this->logger, $this->configFactory, $this->requestStack, $this->requestPolicy);
    

    I think here too.

  3. +++ b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
    +++ b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
    @@ -46,9 +46,18 @@ class RegistryTest extends UnitTestCase {
    
    @@ -65,7 +74,8 @@ public function testGetRegistryForModule() {
    +    $root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
    +    include_once $root . '/core/modules/system/tests/modules/theme_test/theme_test.module';
    

    and here.

dawehner’s picture

FileSize
126.91 KB
2.6 KB

Good catches!

penyaskito’s picture

Thanks! Looks good to me. However I don't feel confident for RTBCing myself.

jibran’s picture

+++ b/core/includes/bootstrap.inc
@@ -284,7 +284,7 @@ function drupal_get_filename($type, $name, $filename = NULL) {
+      $listing = new ExtensionDiscovery(DRUPAL_ROOT);

+++ b/core/includes/install.core.inc
@@ -390,7 +390,7 @@ function install_begin_request(&$install_state) {
+  $listing = new ExtensionDiscovery($container->getParameter('app.root'));

+++ b/core/includes/module.inc
@@ -179,7 +179,7 @@ function module_uninstall($module_list = array(), $uninstall_dependents = TRUE)
+  $listing = new ExtensionDiscovery(\Drupal::root());

I am confused why there are three different approaches?

dawehner’s picture

I am confused why there are three different approaches?

... we need DRUPAL_ROOT for really early installer requests ... once we have the container, we can use $container->getParameter('app.root')
Everywhere else we can use the container parameter injected or, in case we don't have it injectable, \Drupal::root().

dawehner’s picture

FileSize
127.32 KB

Rerolled ...

Status: Needs review » Needs work

The last submitted patch, 78: 2328111-78.patch, failed testing.

martin107’s picture

Status: Needs work » Needs review
FileSize
127.31 KB
1.06 KB

Fixed up incomplete reroll.

EclipseGc’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/update/src/Form/UpdateManagerInstall.php
    @@ -207,7 +207,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    +      $filetransfer = new Local(\drupal::root());
    

    errr... weird that it's lowercase and also this is a non-test class, shouldn't we be able to inject the dependency?

  2. +++ b/core/modules/update/src/Form/UpdateReady.php
    @@ -133,7 +133,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    +        $filetransfer = new Local(\Drupal::root());
    

    Again, we should be able to inject this.

My only other criticism here is that ExtensionDiscovery looks like it could probably be a service in its own right. That's probably outside the scope of this patch, but it's worth noting. Overall, I really like the move away from direct dependencies on Drupal specific code, so this is generally ++ to me. Looks like just a few little issues left with it.

Eclipse

martin107’s picture

Status: Needs work » Needs review
FileSize
129.07 KB
3.31 KB

A Simple fix.

Status: Needs review » Needs work

The last submitted patch, 82: root-2328111-82.patch, failed testing.

martin107’s picture

Status: Needs work » Needs review
FileSize
129.34 KB
509 bytes

Opps .. UpdateUploadTest is now green.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

The feedback of cris got adressed

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I ponder if we can remove define('DRUPAL_ROOT', realpath(__DIR__ . '/../../')); from the PHPUnit bootstrap. The only test fails we have are in UnroutedUrlAssemblerTest and UrlGeneratorTest because the tests are using the constant. If we could remove the define from PHPUnit we would be even closer to removing the dependency and certainly less likely to re-introduce it anywhere unnecessarily.

EclipseGc’s picture

That seems super sensible.

Eclipse

dawehner’s picture

Status: Needs work » Needs review
FileSize
136.68 KB
7.53 KB

Fixed #86 and added a couple of more replacements.

Status: Needs review » Needs work

The last submitted patch, 88: 2328111-88.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
137.94 KB
1.47 KB

Mh, seems to be some reroll conflict.

dawehner’s picture

FileSize
137.94 KB

Reroll

penyaskito’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC.

tstoeckler’s picture

Looked through this as well, and it's quite awesome.

Noticed some things, none of them should block commit, though:

  1. You introduced protected $root; to UnitTestCase (which is good), but a lot of subclasses a duplicating the variable documentation. That could be omitted. (I will open a tiny, unimportant follow-up for that.)
  2. +  app.root:
    +    class: SplString
    +    factory_service: 'app.root.factory'
    +    factory_method: 'get'

    As far as I can tell, this is never actually used, but instead $container->getParameter('app.root') is being used (vs. $container->get('app.root'). Am I missing something?

dawehner’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
137.17 KB
10.65 KB

Good points.

1) Fixed them
2) actually, the 'app.root' service should be used everywhere possible, see core.services.yml.
I had to get rid of the remaining get/setParameter calls

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 94: 2328111-94.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
137.08 KB
tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

looks good.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 97: 2328111-97.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
137.19 KB
746 bytes

Arg!

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Whilst this change is quite disruptive - we gain the benefit of code that is less coupled to global constants and the disruption is only due to patch size and not complexity so I think the benefits outweigh the risk. This patch brings us down to 107 instances of DRUPAL_ROOT (from 288). Also having to rebuild the container after moving a drupal install location seems totally reasonable to me. Committed 91c38c8 and pushed to 8.0.x. Thanks!

Can the CR be updated to include \Drupal::root()M too.

  • alexpott committed 91c38c8 on 8.0.x
    Issue #2328111 by dawehner, martin107, neclimdul: Replace most instances...
dawehner’s picture

Thank you alex!

Adapted the CR.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.