Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/alternative include #13

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

bbrala
Copy link

@bbrala bbrala commented Jan 19, 2022

An experiement if it is possible without patches but with a little trick in the web directory we use on our projects.

This adds:

  • index.php and update.php that includes core
  • symlink for sites/default/files since there is css there

It seems to work pretty fine but because i use a custom packages.json it is not completely as it would be when in the main repository.

Tested usinig:
drupal-core-development-packages.json

{
    "packages": {
        "joachim-n/drupal-core-development-project": {
            "dev-master": {
                "name": "joachim-n/drupal-core-development-project",
                "version": "2.0.0",
                "source": {
                    "url": "[email protected]:bbrala/drupal-core-development-project",
                    "type": "git",
                    "reference": "7ca81136b274d056e3f5fb21c16d7213f1520bd5"
                }
            }
        }
    }
}

Command:
composer create-project --repository=./drupal-core-development-packages.json joachim-n/drupal-core-development-project coredev5 -vvv

@joachim-n
Copy link
Owner

Have you tried this with contrib modules installed?

It seems to me that an unpatched core index.php will make DrupalKernel think $app_root is within the core git clone, and so contrib modules won't get picked up.

@bbrala
Copy link
Author

bbrala commented Jan 20, 2022

Hmm, you are right, i forgot some things. :)

@joachim-n
Copy link
Owner

Yup, so basically, (and I should add something like this to the README and maybe the relevant core issues too) we have:

  • the project root, which is where the top-level composer.json is. That's what Composer knows about, since it runs from there.
  • the app root, also known as the Drupal root, which is where the entry-point index.php is. Drupal core makes assumptions about where that is, which we need to work around (and ideally fix).
  • the scaffold location, which is where the scaffolding plugin puts index.php. That's the same as the app root in this project template's setup

If the Drupal package is symlinked in, then nothing in that package is capable of knowing where the app root is. That information is only known to scaffolded files (because that's where they are) and Composer (because it has the scaffold location defined in composer.json).

@bbrala
Copy link
Author

bbrala commented Jan 21, 2022

I was investigating a little more and something we also do in our projects is change the autoload.php in the directory above core to point at the other vendor directory outside the core directory from the git repository. This kinda means you still need a change in the core files.

Also, in my setup in this branch, drush gets confused in where to find its plugins. It detects the drupal-root perfectly as /repos/drupal/ but when goes to find plugins it still gets confused, i suspect because of the symlinked vendor directory.

Anyways, i'm starting to think i might not be able to do this without patched core files indeed. Perhaps the excersise i'm doing is wasted effort :)

@joachim-n
Copy link
Owner

Thanks for investigating anyway, it's always interesting to have new ideas and approaches!

I'd like to get core fixed so we don't need to patch it -- there's a link to the issue in the README.

Also, if you have any light you can shed on #10 that would be super!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants