dev/drupal#4 - Add Civi\Setup::getPendingAction() helper #16628
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This exposes a new piece of information for downstream consumers of the
civicrm-setup
API.It doesn't change any behaviors or expectations - it merely tracks an extra piece of info.
Before
The
Civi\Setup
interface does not give any reporting about what's going on.After
The
Civi\Setup
interface has a method,getPendingAction()
, which reports the pending action.Technical Details
(1) The basic gist of the change - in each of the installer actions (
installFiles
,installDatabase
,uninstallDatabase
,uninstallFiles
), the patch sets the$pendingAction
at the start and unsets it at the end. This requires wrapping the code in atry... finally...
block (which makes the patch look a little longer than it should).(2) The installer actions are strictly singular - it would not be sensible, for example, to have the
installFiles
anduninstallFiles
actions running at the same time. Thus, the guards within each function.(3) This facilitates dev/drupal#4 and civicrm/civicrm-drupal-8#37 - there were some use-cases in which the auto-install behaviors of
civicrm_install()
andFlushDrupal8.civi-setup.php
would provoke each other (causing a sort of installer-loop). This change makes it possible to avoid the loop without changing the contracts.