dev/drupal#4 - Add Civi\Setup::getPendingAction() helper
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 pending action is strictly singular - it would not be sensible, for example, to have the
`installFiles` and `uninstallFiles` actions running at the same time. Thus, the guards within
each function.
(2) The basic gist of the change - in each of the functions
(`{install,uninstall}{Files,Database}`), set the `pendingAction` at the start and unset
it at the end. The change looks slightly bigger than it should - because it wraps the
existing code within the `try ... finally ...` block.
(3) This facilitates dev/drupal#4 and https://github.com/civicrm/civicrm-drupal-8/pull/37
- there were some use-cases in which the auto-install behaviors of `civicrm_install()`
and `FlushDrupal8.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.