Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
As #1356276: Allow profiles to define a base/parent profile is not done yet, we want to come up with a workaround to not only load the current installation profile, but also some additional ones.
Starting with #1356276-129: Allow profiles to define a base/parent profile there have been some attempts to resolve that.
Proposed resolution
Discuss whether adding such a workaround to core is a good idea or whether these patches should be just applied until #1356276: Allow profiles to define a base/parent profile is resolved
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#10 | 2743197-load_additional_profiles_via_settings-10.patch | 5.6 KB | mpotter |
Comments
Comment #2
mpotter CreditAttribution: mpotter at Phase2 commentedHere is a patch that applies to 8.2.x. The only conflict from the previous issue thread patch was the comments added to ExtensionDiscovery.
Still need to add the tests using the virtual file system. But marking this for Review to see how the other Drupal automated tests work.
Comment #3
naveenvalechafix the patch with some changes.converted teh test to kernel test base
KernelTestBase will not remain in simpletest after 8.2.x #2734663: Update deprecation message for old KernelTestBase in simpletest :( so Moving to unit tests
Comment #5
abhishek-anand CreditAttribution: abhishek-anand at Acquia commentedComment #6
abhishek-anand CreditAttribution: abhishek-anand at Acquia commentedSome minor corrections.
Comment #7
mpotter CreditAttribution: mpotter at Phase2 commentedStarting to try and use this patch for a real distro and running into an issue.
If you try to enable modules in the base_profile in the main profile info.yml file, it seems to fail. When I look at my settings.php file, it isn't writeable so the code in the install.core.inc file wasn't able to take the base_profile from the info.yml and add the profile_directories line to the settings.php.
Comment #8
mpotter CreditAttribution: mpotter at Phase2 commentedTracked part of the problem down to drupal_check_profile() which loops through the dependencies and calls getPath on each one. At this early point of the profile install, nothing has been added to settings.php so the profile_directories haven't been added for the base profile. So if you reference a module within the base profile in the main profile.info.yml it will cause the error:
If I manually add the profile_directories array to settings.php then it gets past this error.
Comment #9
das-peter CreditAttribution: das-peter at Cando commented@mpotter just posted a patch which should solve this: #1356276-158: Allow profiles to define a base/parent profile
Comment #10
mpotter CreditAttribution: mpotter at Phase2 commentedThe patch in #158 of the parent issue #1356276: Allow profiles to define a base/parent profile is great for solving the overall profile inheritance issue. But the purpose of this issue is to split off the code that just sets the profile_directories via $settings into a simple issue that can easily be tested and applied to 8.2.x.
I have re-rolled the patch from #5 that has the new vfStream test (thanks abhishek-anand!!) and have removed the code that writes to the settings.php using the base_profile key. That kind of code needs to stay in the larger parent issue.
I think this is now nice and clean. We have a really straight-forward way to add additional paths to the settings for profile_directories. This code will be needed by the larger parent issue for inheriting profiles. We have a good test for it. Let's try to get this RTBC'd and into 8.2.x so we can focus effort on the larger parent issue.
Edited: To be really clear...all we are doing in this patch is implementing what the existing function setProfileDirectoriesFromSettings() implies that it should be doing.
Comment #11
mpotter CreditAttribution: mpotter at Phase2 commentedComment #12
jhedstromThis is looking good. Quite straightforward approach, and the added test illustrates the behavior.
A few tiny issues:
Nit: one of the
@param
s is missing, and they both need short descriptions.Can you add a code comment here to clarify why this is unset? It isn't immediately obvious I don't think.
Similar to above, this needs
@param
descriptions, and also a short one-liner description at the top of the docblock.Comment #13
mpotter CreditAttribution: mpotter at Phase2 commentedThe new approach I just posted to #1356276: Allow profiles to define a base/parent profile no longer actually uses this method. Will keep this open for a while longer but I think we've got a cleaner method now in the original issue.
Comment #27
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis appears to be a duplicate of https://www.drupal.org/project/drupal/issues/3266057 which is way further along. Closing this one out and moving credit over.