Problem/Motivation

Drupal defines the DRUPAL_ROOT constant, and the DrupalKernel class defines an app root (other issues are trying to make sense of how those two are interdependent -- e.g. #1792310: Wrong DRUPAL_ROOT with non-standard code structure -- but they are basically supposed to be the same thing).

However, if we want to be able to place more PHP files outside of the webroot (see #1672986: Option to have all php files outside of web root. for instance), then there is a problem: the concept of the app root is used for completely different purposes:

1. The folder beneath which Drupal can find the site folder and the settings.php file
2. The folder beneath which Drupal can find the public files folder.
3. The folder beneath which Drupal can find its core files
4. The folder beneath which Drupal can find contrib modules and themes

Moving PHP files out of the web root means that we need a concept of 'app root' which is used for 1 and 3, and a concept of 'web root' which is used for 2.

This issue is about splitting the app root concept into different things:

1. The place where Drupal can find the sites folder, and contrib and custom extensions
2. The web root for Drupal, beneath which it can find the public files folder
3. The root of the Drupal package, beneath which it can find include files, asset files, and so on

This issue depends on #1792310: Wrong DRUPAL_ROOT with non-standard code structure at least, and possibly on others.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

joachim created an issue. See original summary.

joachim’s picture

Issue summary: View changes
joachim’s picture

Status: Active » Postponed

This should be postponed on #1792310: Wrong DRUPAL_ROOT with non-standard code structure, as that introduces a new class Drupal\Composer\Plugin\Locations\DrupalLocation to hold a constant for the app root.

When that gets in, DrupalLocation should have additional constants added to it for the new location concepts we introduce here.

Version: 10.0.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. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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.

joachim’s picture

I'm going to correct myself, and say that since I filed this, in other issues I have started to say 'project root' for the place where the composer.json file is, since Composer calls that a project.