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.
Comments
Comment #2
joachim commentedComment #3
joachim commentedThis 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.
Comment #6
joachim commentedI'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.