The Needs Review Queue Bot โ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
for those using Drupal 9.x, the solution of changing profile from standard to minimal in this article worked for me; hope it'll work for you too (:
- ๐ฉ๐ฐDenmark ressa Copenhagen
Yes, that's a great tip in Drupal 8: Install Site From Existing Configuration from @philipnorton42, and it works well in Drupal 10 as well. Make sure you replace both instances.
If none of your modules or themes contain the string "standard", you can use this to replace via the command line:
sed -i 's|standard|minimal|g' core.extension.yml
- ๐ฏ๐ตJapan tyler36 Osaka
Came across this today with Drupal
10.1
.MR needs rebasing but I get error: "Something went wrong. Please try again."
- ๐ฎ๐ณIndia bhanu951
@tyler36 I will rebase it to 11.x , I have edit access wait for some time, if you are planning to work on it.
- Merge request !4330Issue #2982052: Allow an install hook in profiles installing from configuration. โ (Open) created by bhanu951
- last update
over 1 year ago Build Successful - Status changed to Needs review
over 1 year ago 9:27am 6 July 2023 - Status changed to Needs work
over 1 year ago 7:03am 7 July 2023 - ๐ฉ๐ชGermany luenemann Sรผdbaden, Germany
More then 3000 tests are failing, for example:
1) Drupal\Tests\system\Functional\Module\InstallUninstallTest::testInstallUninstall Array to string conversion /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php:399 /var/www/html/core/lib/Drupal/Core/Extension/ModuleInstaller.php:385 <<<<<<<<<<< Changed by MR !4330 /var/www/html/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83 /var/www/html/core/includes/install.inc:557 /var/www/html/core/includes/install.core.inc:1114 /var/www/html/core/includes/install.core.inc:707 /var/www/html/core/includes/install.core.inc:578 /var/www/html/core/includes/install.core.inc:121 /var/www/html/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:290 /var/www/html/core/tests/Drupal/Tests/BrowserTestBase.php:553 /var/www/html/core/tests/Drupal/Tests/BrowserTestBase.php:366 /var/www/html/core/modules/system/tests/src/Functional/Module/ModuleTestBase.php:31 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
- ๐ฉ๐ชGermany donquixote
The existing MR is weird.
Problem recap
Let's summarize what we need:
- We want to replicate the setup of the original developer who installed the site from an install profile, and who exported the configuration.
- Configuration from the install profile should eventually be ignored, because all config is coming from config/sync.
- Other changes from a profile install hook, which are not covered by config, should still be applied: E.g. to assign 'administrator' role to user 1.
- Non-config changes in hook_install() from other modules that were installed _after_ the install profile should get priority over the changes from the install profile. E.g. if another module wants to remove the 'administrator' role from user 1, that should be be allowed.
- The hook_install() in the install profile might require some modules that the profile declares as dependencies, but which are no longer installed in the exported config.
Proposed solution
The site-install from existing config should do two separate steps:
- Step 1 installs from the install profile.
- Step 2 imports the configuration.
Probably this needs two separate processes.
- ๐จ๐ญSwitzerland bircher ๐จ๐ฟ
I am not particularly happy with the current MR, for one it changes things in node_install and user_install that seem unrelated. Also if we allow an install hook we should just add it to one of the test profiles, no need to create it in a test only.
But more importantly I don't think the proposed solution from #101 would work. If we install normally and then in a second step import the config some install profiles will still not work and we just find out later and have no way to predict it. The problem is that you can uninstall modules, but only sometimes! There are a bunch of uninstall validators that prevent you from uninstalling a module if there is content for it still. So if a install profiles adds something that prevents one of the optional modules to be uninstalled without any manual interaction then the "import config" step will fail.
This is in a way the same problem that prevented us from allowing install hooks in the first place. Install hooks were allowed to make assumptions that are not true in the "install from config" scenario, even if we don't run the install hook of the profile not when the extensions are installed but only at the end of the profile installation process. (ie a profile can assume that optional modules are installed in the normal installation, but not in the "from existing config" step, and of course the same is true for the default config in the profile)It has now been a while that these profiles are missing out on a key feature of Drupal core. So maybe it is now ok to just call the profiles install hooks at the end of the install process and skip them in the normal extension installation. This would work in both cases install from config or not. Then if the hook makes assumptions about what is available then it is a bug in the profile and it should add checks around the assumptions.
- ๐ฆ๐ฑAlbania elvin - albania drupal developer
Today i came accross this: https://www.drupal.org/node/3432357 โ
I was able to uninstall the "Standard" profile, export cofig, and then i was able to do a
drush site:install --existing-config
successfully. - ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
@elvin - albania drupal developer yep I think that that change makes this change now unnecessary to pursue.
- ๐น๐ทTurkey Kartagis Istanbul
Corrected a grammatical typo in title.
- ๐ง๐ชBelgium ericvl
@elvin
Is there a way to install Drupal and getting the choise of selecting the "existing configuration" without making use of Drush? Just by the user interface.
I don't have Drush on my site. therefor one needs access to the shell and I haven't. - ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
@ericvl yes if you the exported config in a directory and
$settings['config_sync_directory']
in your settings.php already and you visit the interactive installer you'll get the option to install from existing configuration via the UI. - ๐ง๐ชBelgium ericvl
@alexpott
Thank you for the quick response but it doesn't work for me. I do not get the selectbutton for existing config.
I'm using Drupal 10.3.5. Maybe I should use the dev version?What I do:
- export the configuration and import it back in so that the contents of the config_sync_directory mirrors what is in the database.
- remove the standard profile
- remove all tables in yhe database. Remark: the specs of the database are still in the settings.php
- I'm visiting the interactive installer by accessing the root of site (this redict to the installer)
- I can not select the existing config.If you can spare a few minutes to look into this, thanks
- ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
@ericvl you need to uninstall the standard profile prior to exporting the configuration. Then on the select install profile screen you will see an option during the installer - where you select the install profile. See below:
- ๐ง๐ชBelgium ericvl
@alexpott
Thank you for helping me out. It works.
Sorry to bother you with such a stupid problem.
Thnx