Problem/Motivation
Drupal core currently is forced to be in the core directory inside of the webroot. This means that an admin is forced to use Composer Installers if they want to install Drupal core with composer. This also presents a potential security hazard as all of Drupal core's code must be in the web-root.
Proposed resolution
Make Drupal core folder agnostic like Symfony and Laravel Framework. This allows admins to use Drupal core as if it were any other dependency of their project. Thereby giving Drupal admins and immense amount of flexability to mix-and-match Drupal core with other dependencies.
Remaining tasks
We'll need to deal with the front-end assets, since we don't want to serve those directly from vendor. Perhaps the various caching layers can take care of this for us.
API changes
Every part of Drupal that is "aware" of the folder it is in, will need to be re-worked to not be. Since we are already using Composer's Autoloader, some of this has already been done, but there's still a lot of legacy systems that are required to be in the core directory and must be aware of the web-root.
Also, this might require some sort of "Kernal" to load contrib modules, or we could force contrib to use Composer. :)
Comments
Comment #1
davidwbarratt commentedComment #2
davidwbarratt commentedComment #3
mile23Comment #4
catchWork on this can be done in 8.3.x. We might not get there, but don't know until you try. This issue needs a more concrete issue summary though.
Comment #8
mile23Comment #9
fgmFWIW, Assetic used to be present in core at some point before 8.0 but got removed before release. It would be interesting to find the issue(s) which led to its insertion, then removal, to inform this issue.
Comment #10
andypost@fgm the history is
- #352951: Make JS & CSS Preprocessing Pluggable
- #2356845: Remove the assetic library
Comment #11
mile23There was also a ton of work on this issue, but it was CWF: #1762204-191: Introduce Assetic compatibility layer for core's internal handling of assets
So the reason we're talking about assetic is because we don't want to serve files directly from vendor.
I'm not well-versed in it, but it seems like our various caching and asset aggregation systems could take care of that for us. We generally have a policy of caching everything, so we could enforce that for a build-as-needed-and-cache approach.
Comment #13
dwwCleaned summary of references to assetic and added Mile23's point that the caching / aggregation layers might solve that already (more or less).
Also, +1 following! ;)
Cheers,
-Derek
Comment #16
mile23This is really a plan issue.
Adding NF because we have to plan how contrib will work. That issue might already exist; I didn't look too hard.
Removing NISU because the summary is still accurate for the plan. @catch #4 is correct: We need concrete proposals.
Comment #19
joachim commentedHow does this relate to #2590077: [meta] Decoupling drupal/core from predefined directory structure? Duplicate, child issue, related?
At any rate, here's what I think are the next steps in this space:
- #1792310: Wrong DRUPAL_ROOT with non-standard code structure
- #3208975: split the concept of DRUPAL_ROOT/app root into app root and Drupal web root
Comment #25
quietone commentedComment #26
joachim commentedThis will need #1792310: Wrong DRUPAL_ROOT with non-standard code structure.
Also,is this not a duplicate / covered by #1672986: Option to have all php files outside of web root.?