Wrong DRUPAL_ROOT with non-standard code structure

Created on 22 September 2012, over 12 years ago
Updated 9 September 2024, 3 months ago

Problem/Motivation

When Drupal in installed in a non-standard installation structure, DRUPAL_ROOT is defined incorrectly and various parts of Drupal don't work.

This is important because the standard way of developing a Composer package, by defining a path repository in a project to symlink a git clone of the package, isn't currently possible with Drupal core.

Definitions

- project root: the folder where the root composer.json is
- app root (also drupal root): The folder where Drupal's entry-point index.php is. This is where the HTTP request to Drupal is made. Typically PROJECT_ROOT/web.
- scaffolding: The process which copies files into the app root when Drupal is installed with Composer. This is done by a Composer plugin within Drupal.
- Composer symlinking: The technique of using a 'path' repository for a package which points to a local git clone of the package. This causes Composer to symlink the package from the git clone into its location in the project. This is a method used to develop a package which needs to be used in the context of a Composer project -- such as Drupal core.

There are various kinds of installation structures for Drupal, depending on where and how Drupal core is installed:

- drupal/recommended-project: drupal scaffolded into the web/ folder.
- plain git clone of Drupal core, with `composer install` run at its root.
- drupal/legacy-project: drupal scaffolded into the project root.
- drupal core symlinked in by Composer, such as with the joachim-n/drupal-core-development-project Composer template. (This is the best way to develop a Composer package within a project -- see https://medium.com/pvtl/local-composer-package-development-47ac5c0e5bb4.)
- drupal installed in vendor/ - this is not possible because of other issues, and will not be fixed here, but this issue should aim to make DRUPAL_ROOT correct for this structure.

What causes the problem

We use Composer to install Drupal into the app root rather than /vendor, and Drupal
expects to find files like settings.php and extensions in the app root. Because of this, code in a Drupal project falls into several 'zones':

- Composer autoloader
- Composer vendor code
- Drupal core
- Drupal scaffolded files such as index.php and update.php
- Drupal settings, files, and extensions

These different zones don't all know how to get hold of code in the other zones:

- The autoloader always knows how to load Composer vendor code, and Drupal core code, because Composer installed it.
- Composer vendor code, e.g. Drush, knows the location of the Composer autoloader relative to itself, because it knows it's in vendor/foo/bar. But it has to make assumptions for the location of Drupal core or scaffolded files.
- Drupal core doesn't know the location of anything, because where it was installed is defined in composer.json. It has to make assumptions about how to get to the autoloader. It does that with a special autoload.php file at the root of the Drupal repository. (For the drupal/recommended-project template, an autoload.php is scaffolded into web/ so that it can go one level up and find the vendor folder. In drupal/legacy-project Drupal's include() loads the repository's autoload.php, and in drupal/recommended-project the same include() loads the scaffolded autoload.php.)
- Drupal core has to make assumptions about how to find its settings.
- Composer vendor code has to make assumptions about how to find Drupal settings. This affects things like Drush and Drupal Console.
- Drupal's scaffolded files can know about all code locations, since they are written by the scaffold plugin during Composer installation. During this process we can get the location of anything from Composer, and write it into the scaffolded files.
- Drupal settings.php file: knows the location of scaffolded index.php, as that is fixed relative to itself.

These assumptions all break in non-standard installation structures. In particular, the use of __DIR__ in these assumptions breaks when Drupal is symlinked into a project.

Fixing this is difficult because Drupal has MANY different entry points:

- HTTP request to the index.php file which is scaffolded into the app root
- HTTP request to scaffolded install.php
- HTTP request to scaffolded update.php
- HTTP request to core/rebuild.php, which is not scaffolded.
- tests run with phpunit
- tests run with run-tests.sh (this case doesn't really count, as run-tests.sh is only meant for Drupal CI, whose installation structure is a known quantity: see 🐛 document run-tests.sh as not intended for public consumption Fixed )
- code in a Composer package (e.g. Drush or Console) bookstraps Drupal
- scripts in core/scripts

Proposed resolution

Various approaches have been tried (see old branches in the issue fork). But ultimately, there's only one thing we can rely on: Composer knows the location of everything, because it installs everything.

Asking Composer runtime API every page load is potentially a performance hit, but it's simple to have Composer write a file containing the data we need during Composer installation.

So the plan is as follows:

1. For Composer vendor code which needs to find Drupal, have core's drupal/core-composer-scaffold Composer plugin write the locations class file into the plugin's own folder.

The file is written as a class, so that it can always be loaded by Composer. (Making it a plain file registered as a Composer autoload 'file' item causes problems with package dependency hierarchy.) This class currently only defines one constant, but #3208975: split the concept of DRUPAL_ROOT/app root into app root and Drupal web root could expand on that.

For cases where drupal/core-composer-scaffold is not installed, fall back on the existing behaviour for guessing the location of Drupal core.

Deprecate the $app_root parameter to DrupalKernel, since DrupalKernel uses the plugin.

2. For code in Drupal core which needs to get to the autoloader, replace all uses of __DIR__ with code which uses the actual path of the executed file. This is to prevent PHP from resolving symlinks.

Remaining tasks

See comment in the MR

API changes

- new functionality for drupal/core-composer-scaffold
- new DrupalLocations class, which 3rd party code can use to find Drupal's location
- DrupalKernel's $app_root parameter in various methods is deprecated
- DrupalKernel::guessApplicationRoot is deprecated and renamed. This is protected but Drush uses it, for instance.

Original summary

I usually link drupal inside my www directory like seen in the following ls output.
I think symlinking like that is not unusual, as it helps with version controlling of own projects.

core -> ../drupalcheckout/core
.htaccess
../drupalcheckout/index.php
../drupalcheckout/modules
profiles
robots.txt -> ../drupalcheckout/robots.txt
sites
themes -> ../drupalcheckout/themes

i've attached a script which will setup such an environment in the current directory.

With this setup BASE_ROOT in install.php will be set to the drupalcheckout directory.
Install then tries to find a settings.php in ../drupalcheckout/sites/default and not ./sites/default.

same Problem and fix should be considered for update.php and authorize.php

related discussions:
#1055856: Optimize settings.php discovery
#484554: Stop relying on Apache for determining the current path

🐛 Bug report
Status

Needs review

Version

11.0 🔥

Component
Base 

Last updated 2 days ago

Created by

🇩🇪Germany derEremit

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇺🇦Ukraine voleger Ukraine, Rivne
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Custom Commands Failed
  • last update over 1 year ago
    Composer error. Unable to continue.
  • Status changed to Needs review over 1 year ago
  • 🇬🇧United Kingdom joachim

    New branch & MR for 11.x

  • last update over 1 year ago
    Composer error. Unable to continue.
  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    Have not reviewed.

    But appears to have composer error and can't trigger retest.

  • last update over 1 year ago
    Custom Commands Failed
  • last update over 1 year ago
    Custom Commands Failed
  • last update over 1 year ago
    30,150 pass
  • Status changed to Needs review over 1 year ago
  • 🇬🇧United Kingdom joachim

    Fixed the errors.

  • last update over 1 year ago
    30,150 pass
  • Status changed to Needs work over 1 year ago
  • 🇳🇱Netherlands bbrala Netherlands

    I only found one real question in regards of a missed dirname(__DIR__, 2); in one of the files. There is other places we might want to use our new found power instead of some of the references through __DIR__. Most seem in tests though which i'd not touch probably.

    I've run through this whole issue and went through the MR intensely. This seems like an elegant solution that will enable us to take a step forward in how core is structured.

  • last update over 1 year ago
    30,152 pass
  • last update over 1 year ago
    30,152 pass
  • last update over 1 year ago
    30,156 pass
  • last update over 1 year ago
    30,156 pass
  • Status changed to Needs review over 1 year ago
  • 🇬🇧United Kingdom joachim

    Resolved all points.

  • Pipeline finished with Failed
    over 1 year ago
    Total: 1099s
    #20178
  • 🇺🇦Ukraine voleger Ukraine, Rivne

    The latest version of MR looks great. Added suggestions for improvement.
    The only thing that I want to clarify is the upgrade path for the existing projects. I reviewed CR, and there is only mention of the new API, but no upgrade steps. As I understand, existing projects need to update the autoload section of the composer.json file, right?

  • 🇬🇧United Kingdom joachim

    > The only thing that I want to clarify is the upgrade path for the existing projects. I reviewed CR, and there is only mention of the new API, but no upgrade steps. As I understand, existing projects need to update the autoload section of the composer.json file, right?

    Oh that's a good point!

    In the MR, any code that uses the \Drupal\Composer\Plugin\Locations\DrupalLocation class also has a fallback for if that class is not found.

    That fallback is for the benefit of existing installations, but also for plain git clones, where there is no drupal scaffolding done and so the DrupalLocation won't get written.

    So actually, the CR needs to be changed, and possibly the docs as well, to say this: you have access to DrupalLocation IF you know you are in a project that uses drupal/core-drupal-locations -- in other words, in code that you own in your project, or in a Composer project template that requires drupal/core-drupal-locations and sets up scaffolding. Generally, in thid-party code, you should use DrupalKernel::getAppRoot().

  • Status changed to Needs work over 1 year ago
  • 🇺🇦Ukraine voleger Ukraine, Rivne

    Ok, so PR looks good. I set NW for CR updates.

  • Status changed to Needs review over 1 year ago
  • 🇺🇦Ukraine voleger Ukraine, Rivne

    MR needs to rebase

  • Status changed to Needs work over 1 year ago
  • 🇺🇦Ukraine voleger Ukraine, Rivne
  • Open on Drupal.org →
    Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    Not currently mergeable.
  • Pipeline finished with Failed
    over 1 year ago
    Total: 1180s
    #22921
  • last update about 1 year ago
    30,210 pass
  • Pipeline finished with Failed
    about 1 year ago
    Total: 269s
    #23451
  • Status changed to Needs review about 1 year ago
  • 🇬🇧United Kingdom joachim

    Updated the README and the CR.

  • last update about 1 year ago
    30,365 pass
  • Pipeline finished with Success
    about 1 year ago
    Total: 1105s
    #23652
  • Status changed to RTBC about 1 year ago
  • 🇺🇦Ukraine voleger Ukraine, Rivne

    GitlabCI (wow, 4 times faster than DrupalCI) was not happy with CSpell check. I added an entry to a dictionary. The changes look good to me for RTBC

  • Status changed to Needs work about 1 year ago
  • 🇬🇧United Kingdom joachim

    'definining' is a typo, not a word :)

    I'll fix.

  • Status changed to RTBC about 1 year ago
  • 🇬🇧United Kingdom joachim

    Fixed.

  • last update about 1 year ago
    30,365 pass
  • Pipeline finished with Failed
    about 1 year ago
    Total: 1476s
    #23683
  • Status changed to Needs work about 1 year ago
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    I think the BC layer in bootstrap.inc is not correct - it should use Drupal\Locations\DrupalLocation; and not use Drupal\Composer\Plugin\Locations\DrupalLocation; - also the comment in bootstrap.inc is out-of-date.

    Plus I think people need to guidance about whether to deploy DrupalLocation.php or should it be it .gitgnore like the other scaffolded files.

  • 🇬🇧United Kingdom joachim

    > I think the BC layer in bootstrap.inc is not correct

    Fixed, and same problem in DrupalKernel too.

    > Plus I think people need to guidance about whether to deploy DrupalLocation.php or should it be it .gitgnore like the other scaffolded files.

    It can be either -- it's documented in the code, but I'll add it to the README:

     * To ensure the project's codebase is portable, the generated class must not
     * use absolute paths. It should instead use the __DIR__ constant, which in the
     * generated class will give the project root.
    

    > should it be it .gitgnore like the other scaffolded files

    We could do that, but code to add files to .gitignore is in the drupal/core-composer-scaffold and it's marked @internal. Is it ok for the locations plugin to call the scaffold plugin given they're both Drupal core?

  • last update about 1 year ago
    Custom Commands Failed
  • Pipeline finished with Failed
    about 1 year ago
    Total: 303s
    #23829
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    We could do that, but code to add files to .gitignore is in the drupal/core-composer-scaffold and it's marked @internal. Is it ok for the locations plugin to call the scaffold plugin given they're both Drupal core?

    Maybe this new composer plugin should be part of scaffold - as it is very similar to the autoload.php we're scaffolding.

  • 🇬🇧United Kingdom joachim

    I did look at doing that at one point, but I felt that its function was sufficiently different from Scaffold to count as feature creep - Scaffold just copies files from one place to another according to a recipe. This generates a class.

  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    Hiding all the patches.

  • 🇬🇧United Kingdom joachim

    DrupalCon Lille conversation -- things to change:

    1. Merge new Composer plugin into Scaffold - we've agreed that Scaffold's purpose is generally 'Make the Composer project happy with Drupal's weirdnesses'. It already generates the autoload.php file.
    2. Look at https://getcomposer.org/doc/04-schema.md#classmap instead of PSR autoload.
    3. Be clearer in the CR about what existing sites need to or can do -- cover various different setups.

  • Pipeline finished with Failed
    about 1 year ago
    Total: 324s
    #50258
  • First commit to issue fork.
  • Pipeline finished with Failed
    12 months ago
    Total: 181s
    #71822
  • Pipeline finished with Failed
    12 months ago
    Total: 162s
    #71829
  • Pipeline finished with Success
    12 months ago
    Total: 650s
    #71841
  • 🇺🇸United States capysara

    I rebased and fixed conflicts in composer.lock and core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php. In FunctionalTestSetupTrait.php, this line had been removed altogether: chdir(DRUPAL_ROOT), see 5ef2211afc. In this MR, the line was changed to chdir($app_root). I don't have much context for either issue so I kept the change from this issue.

    I updated the error messaging for coding standards, but I didn't address any of the comments in the MR. I was just trying to get this back to green.

    (Also, sorry Joachim, I didn't notice Assigned until after I started committing things.)

  • Issue was unassigned.
  • 🇬🇧United Kingdom joachim

    Thanks!
    I probably should have unassigned myself a while ago -- haven't got the mental space to dive back into one at the moment. Thanks for keeping it ticking over!

    It might be worth seeing if we can do without the chdirs() which are removed in 5ef2211afc.

  • 🇬🇧United Kingdom joachim

    I'm trying to rebase this, and I'm not managing to update Composer from lock, and I don't remember how I did it previously!

    > COMPOSER_ROOT_VERSION=11.0-dev composer update --lock

    says:

    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Root composer.json requires drupal/core == 11.9999999.9999999.9999999-dev (exact version match), it is satisfiable by drupal/core[11.x-dev] from composer repo (https://repo.packagist.org) but drupal/core[11.0-dev] from path repo (core) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.
    

    and

    > COMPOSER_ROOT_VERSION=11.9999999.9999999.9999999-dev composer update --lock

    works, but then the version set in composer.lock is all wrong.

  • 🇺🇸United States darren oh Lakeland, Florida

    You have be in the 11.x branch to update the lock file.

  • 🇬🇧United Kingdom joachim

    So is the right way to do it:

    1. merge 11.x into feature branch
    2. Update lock file
    3. switch to feature branch, commit changes
    4. switch to 11.x and do a git reset --hard to put it back

    ?

  • 🇬🇧United Kingdom joachim

    Aha, that's worked. Thanks!!

  • Pipeline finished with Failed
    10 months ago
    Total: 170s
    #105924
  • 🇬🇧United Kingdom joachim

    > 2. Look at https://getcomposer.org/doc/04-schema.md#classmap instead of PSR autoload.

    That's not going to work. I've tried it, and any Composer operation which happens before the DrupalLocation.php is written produces this error, multiple times:

    > Could not scan for classes inside "DrupalLocation.php" which does not appear to be a file nor a folder

    That happens when doing `composer drupal:scaffold` and probably will happen when first installing Drupal with Composer.

    The problem is that 'classmap' autoloading looks in the given list of files to find classes to register. That's unlike 'psr-4' autoloading, which merely declares directories to Composer, and it will only look for files when a class is about to be loaded.

    So with psr-4 it's fine to declare a file that doesn't exist yet, but with classmap it's not.

    @alexpott - your concern was that the namespace could clash with other things. What if make it more specific?

    Instead of:

    > namespace Drupal\Locations;

    we have:

    > namespace Drupal\Composer\Locations;

    The Drupal\Composer namespace is used by things in our /composer folder, nobody else should be using that namespace.

  • Pipeline finished with Failed
    10 months ago
    Total: 171s
    #106093
  • 🇬🇧United Kingdom joachim

    Moved all the code to the scaffold plugin.

    I've started trying to get the gitignore to work and can't quite get it working :/

  • Pipeline finished with Failed
    10 months ago
    Total: 130s
    #110614
  • 🇬🇧United Kingdom joachim

    joachim changed the visibility of the branch 1792310-locations-class-writer-plugin-11 to hidden.

  • Status changed to Needs review 7 months ago
  • 🇬🇧United Kingdom joachim

    Figured out gitignore.

    Made a new branch & MR as the old branch name wasn't accurate any more now that the new functionality is being added to the existing drupal/core-composer-scaffold Composer plugin.

    I've hidden the old branch.

    New MR is: https://git.drupalcode.org/project/drupal/-/merge_requests/8216

  • Pipeline finished with Failed
    7 months ago
    Total: 133s
    #185230
  • Pipeline finished with Failed
    7 months ago
    Total: 132s
    #187441
  • Pipeline finished with Failed
    7 months ago
    Total: 133s
    #187566
  • Status changed to Needs work 7 months ago
  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily 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 Needs review 7 months ago
  • 🇬🇧United Kingdom joachim

    Rebased.

  • Pipeline finished with Failed
    7 months ago
    Total: 135s
    #189000
  • Pipeline finished with Failed
    7 months ago
    Total: 101s
    #189648
  • Pipeline finished with Failed
    7 months ago
    Total: 179s
    #189833
  • Pipeline finished with Failed
    7 months ago
    Total: 169s
    #189835
  • Status changed to Needs work 7 months ago
  • 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 necessarily 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.

  • Pipeline finished with Failed
    7 months ago
    Total: 190s
    #189879
  • Pipeline finished with Failed
    7 months ago
    Total: 512s
    #189913
  • Pipeline finished with Failed
    7 months ago
    Total: 197s
    #189979
  • Pipeline finished with Failed
    6 months ago
    Total: 192s
    #208471
  • Pipeline finished with Failed
    6 months ago
    Total: 615s
    #208510
  • Pipeline finished with Failed
    6 months ago
    Total: 545s
    #212901
  • Pipeline finished with Failed
    6 months ago
    #212907
  • Pipeline finished with Success
    6 months ago
    Total: 539s
    #212941
  • Status changed to Needs review 6 months ago
  • 🇬🇧United Kingdom joachim

    Finally got all tests passing!!!!

  • Status changed to Needs work 6 months ago
  • 🇺🇦Ukraine voleger Ukraine, Rivne

    Deprecation messages are outdated.

  • Status changed to Needs review 6 months ago
  • 🇬🇧United Kingdom joachim

    Fixed. Back to NR.

  • Pipeline finished with Success
    6 months ago
    Total: 515s
    #213057
  • Status changed to RTBC 6 months ago
  • 🇺🇦Ukraine voleger Ukraine, Rivne

    Looks good for me. I can't wait to see it in core for implementation of additional project template in the scope of #1672986: Option to have all php files outside of web root.

  • 🇬🇧United Kingdom joachim

    Updated proposed resolution in IS.

  • 🇫🇷France andypost

    HTTP request to core/modules/statistics/statistics.php (yay! special case!)

    IS should not mention removed in 11.x statistics module

  • 🇬🇧United Kingdom joachim

    Updated IS for #247.

  • Status changed to Needs work 6 months ago
  • 🇳🇿New Zealand quietone

    Thanks for working to complete this old issue!

    I read the issue summary and skimmed through the comments. There is work to do for the last comment, so setting to NW.

    I read through the comments in the MR and left some suggestions. Would it not be simpler to use the same language and style that the ProxyBuilder uses for building files? I think the class LocationsClassTemplate could be in the manager file. I am not sure that 'manager' is an appropriate name. I'll have to look again at another time.

    I don't see history here for why there is a change record 'Obsolete ...'. What ever the reason, in the future just update the draft CR on an issue. Having unwanted extras adds to the difficulty in managing the change records.

  • Pipeline finished with Canceled
    6 months ago
    Total: 156s
    #216767
  • Pipeline finished with Canceled
    6 months ago
    Total: 13s
    #216770
  • Pipeline finished with Canceled
    6 months ago
    #216771
  • Pipeline finished with Canceled
    6 months ago
    Total: 10s
    #216772
  • Status changed to Needs review 6 months ago
  • 🇬🇧United Kingdom joachim

    > Would it not be simpler to use the same language and style that the ProxyBuilder uses for building files?

    Could you be more specific?

    I've previously looked a bit at ProxyBuilder, and the whole area of proxy services is one I find to be pretty badly documented. I don't really understand why ProxyBuilder exists or how it does what it does. Also, ProxyBuilder has to write much more complex classes than in this case -- here we just need to replace tokens with strings. ProxyBuilder has to write methods and all sorts.

    > I think the class LocationsClassTemplate could be in the manager file.

    I wanted to keep it separate for clarity. That way the class that holds the code for the DrupalLocations file is just about that code.

    > I am not sure that 'manager' is an appropriate name. I'll have to look again at another time.

    I followed the same pattern as ManageGitIgnore, also in the scaffold plugin. ManageGitIgnore is responsible for creating a .gitignore file. So ManageDrupalLocations is responsible for creating a DrupalLocations file.

    > I don't see history here for why there is a change record 'Obsolete ...'. What ever the reason, in the future just update the draft CR on an issue. Having unwanted extras adds to the difficulty in managing the change records.

    The approach was completely changed. I don't think it would make sense for the node history of the CR node to go from saying one thing to saying something utterly different. The obsolete CR can be deleted.

    I'm not sure about your suggested change from 'app root' to 'application root'. I made the changes and then thought to check core -- in 11.x there are LOTS of uses of the term 'app root'. So I'm wondering about whether to revert those commits I just made, and keep consistent with what's already in core.

    Also, your suggestion for this doesn't work:

       *   The web root of the project. This is either defined in the project root
       *   composer.json, or taken to be the project root by default.
    

    It needs to be a single sentence, I think.

  • Pipeline finished with Failed
    6 months ago
    Total: 510s
    #216774
  • Pipeline finished with Success
    6 months ago
    Total: 476s
    #216785
  • Pipeline finished with Success
    5 months ago
    #231689
  • 🇳🇿New Zealand quietone

    I did a light review of my previous comments and the comments in the MR. (It is noisy here and it is hard to think). There is just the one sentence we are working to agree on. I have made a new suggestion.

    This time I noticed that that new classes are not declaring stricts types, Is there a reason? And there are new methods which are not defining return types. Should they? Oh, that noise is helping me to make mistakes. I didn't see your comment and the use of 'app root' in comments and I applied my suggestion. Sorry, about that.

    Regarding ProxyBuilder, \Drupal\Component\ProxyBuilder\ProxyBuilder includes embedded strings that are placed in the generated files. I think it is much simpler, avoids another class and method, and with the bonus it easier to read (at least for me). As for the other I hadn't considered ManageGitIgnore. That all can wait for an opinion from another committer.

  • 🇺🇸United States smustgrave

    @joachim thoughts on #251?

  • Pipeline finished with Failed
    3 months ago
    Total: 414s
    #278340
  • 🇬🇧United Kingdom joachim

    Thanks for the bump @smustgrave! I'd forgotten about this needing work from me!

    > There is just the one sentence we are working to agree on. I have made a new suggestion.

    I've taken that, and added more detail, because I think it's important to say what happens here if the root composer.json doesn't specify the web-root.

    > This time I noticed that that new classes are not declaring stricts types, Is there a reason?

    That's not yet a standard AFAICT -- 🌱 [policy, no patch] Use declare(strict_types=1) in new code Active

    > And there are new methods which are not defining return types. Should they?

    The only one I can see failing that is getApplicationRoot(). Fixed.

    > I didn't see your comment and the use of 'app root' in comments and I applied my suggestion. Sorry, about that.

    I'm not sure what your opinion is here, as I can't see your changes in the MR any more -- did you conclude it's ok to use 'app root' for now?

    > Regarding ProxyBuilder, \Drupal\Component\ProxyBuilder\ProxyBuilder includes embedded strings that are placed in the generated files.

    Do you mean core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php?

    I actually find that much harder to read and work with, certainly while developing how the written file should look.

    I work iteratively, so I get the DrupalLocation written, look at what I want it to have, or what I need to change, and then go and make changes to LocationsClassTemplate. It helps me if LocationsClassTemplate looks mostly like the code that I want to output!

  • Pipeline finished with Failed
    3 months ago
    Total: 516s
    #278356
  • 🇳🇿New Zealand quietone

    I tried to test this today but the diff does not apply to 11.x and yet GitLab says it does. There are also 2 failing tests.

    The approach was completely changed. I don't think it would make sense for the node history of the CR node to go from saying one thing to saying something utterly different. The obsolete CR can be deleted.

    It is perfectly fine for the change record history to reflect the changes to the solution. In fact, it should be preserved to do exactly that, to show the history. And, in doing that, it also prevent making work for someone to cleanup the change records.

    Thank for the changes in the MR.

  • 🇬🇧United Kingdom joachim

    Rebased on 11.x.

    Sorry about the new CR -- not sure how best to fix that.

  • Pipeline finished with Failed
    3 months ago
    Total: 687s
    #289379
  • Pipeline finished with Failed
    3 months ago
    Total: 535s
    #292070
  • 🇬🇧United Kingdom joachim

    I talked to @longwave about this at DrupalCon Barcelona last week.

    1. He asked about whether the DrupalLocations value is an absolute or relative path, in case the DrupalLocations class is committed and deployed. It's relative, precisely for that reason. I've added a note about that to the issue summary.

    2. On the matter of terminology 'app root' vs 'application root', he suggested we could use 'application root' in documentation, and $app_root as a variable name. I looked into doing that, but I found that 'app root' is used in LOTS of places in existing code comments. So I think this MR should stay consistent with that, and a follow-up issue can look at that.

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

  • 🇩🇪Germany rkoller Nürnberg, Germany

    The MR might need some more work in the context of recipes (probably recipecommand.php in particular). I am using https://github.com/joachim-n/drupal-core-development-project and i've tried to apply a recipe recently. due to the symlinking of the core folder between the repos/drupal and the docroot web folder i ran into issues when i've executed php core/scripts/drupal recipe ../recipes/tour_core -vvv in the docroot web folder. There i ran into the error The specified database connection is not defined.
    I've ssh'ed into the container and went to /var/www/html/web/core/scripts. there i tried php -a and ran print_r(__DIR__); which returned /var/www/html/repos/drupal/core/scripts instead. so executing the recipe command was not using the sites folder in web but in repos , which doesnt have any database credentials provided and therefore the error.
    If you try instead of running that php command in the web folder ,drush recipe instead, drush manages that the database is found and the site is correctly bootstrapped based on the web folder instead of falling back to the repos folder. BUT i then run into another error: The following extensions are missing and are required for this recipe: tour. the tour module is installed in the web folder context but not available in the repos context. so it looks like the recipe command is probably falling back and relying onto repos/drupal instead of web in recipecommand.php in line 66 . I'll set the issue back to needs work.

    *I've debugged and explored the problem at Drupal Dojo Austin with @rocketeerbkw and @leeotzu last night.

Production build 0.71.5 2024