- Merge request !5270Issue #3103962: Set config installer isSyncing to TRUE before running module preinstall hook. β (Open) created by godotislate
- Status changed to Needs review
over 1 year ago 9:59pm 6 November 2023 - First commit to issue fork.
- Status changed to RTBC
over 1 year ago 8:05pm 7 November 2023 - πΊπΈUnited States smustgrave
Rebased to run test-only feature
1) Drupal\KernelTests\Core\Config\ConfigImporterTest::testIsSyncingInHooks \Drupal::isConfigSyncing() returns TRUE Failed asserting that null is true. /builds/issue/drupal-3103962/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:121 /builds/issue/drupal-3103962/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55 /builds/issue/drupal-3103962/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php:848 /builds/issue/drupal-3103962/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 FAILURES! Tests: 23, Assertions: 136, Failures: 1.
Hiding files for clarity.
Issue summary seems clear about what is being fixed and matches the solution in the MR.
LGTM!
- Status changed to Needs work
over 1 year ago 3:03am 22 December 2023 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Issue credits
Left some questions on the MR, tl;dr I think hook_module_preuninstall has the same issue and wonder if perhaps we should be doing the fix inside ::updateKernel so it resolves both issues at once.
- π¬π§United Kingdom alexpott πͺπΊπ
@larowlan excellent point about uninstall. Install and uninstall should be mirrors.
I'm slightly dubious about the use-case here because what are you doing in pre-install - really shouldn't be doing anything permanent - so whatever is happening probably should happen regardless of whether we are syncing - but hey workspaces does interesting stuff here but it is inconsistent so +1 to fixing.
I think we should also consider adding is_syncing to the hook signature to anyone who implements hook_module_preinstall() has to consider the config syncing case.
I agree use cases are pretty obscure, and I'm having trouble recalling exactly how it was I ran into it four years ago. I believe that I was working on a project that had an install profile that used Config Rewrite ( https://www.drupal.org/project/config_rewrite β ). That module has an hook_module_preinstall() implementation that I wanted to prevent from happening when installing from existing configuration. Though it looks like between then and now they found a different way to do that detection.
- Status changed to Needs review
over 1 year ago 9:54pm 22 December 2023 Addressed review comment to restore state of config installer in ::updateKernel.
Added $is_syncing value as second parameter to hook_module_preinstall() and hook_module_preuninstall implementations.
Updated tests and rebased.
Added CR and updated IS.- Status changed to Needs work
over 1 year ago 8:53am 23 December 2023 - π¬π§United Kingdom alexpott πͺπΊπ
@godotislate - nice work - one tiny nit in a kinda out-of-scope change and this will be rtbc.
- Status changed to RTBC
over 1 year ago 11:35am 23 December 2023 Applied suggested change and moved to RTBC per last comment.
- Status changed to Fixed
over 1 year ago 8:50pm 23 December 2023 -
alexpott β
committed ba827d46 on 11.x
Issue #3103962 by godotislate, smustgrave, alexpott, larowlan:...
-
alexpott β
committed ba827d46 on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.