diff --git a/CHANGELOG.md b/CHANGELOG.md index 57a0975af22648ebae7702c1d2eb27ee63f81128..7f7296c42ea18790eb0b4d277d925b280759c96f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -# Version 1.84 (not yet released) +# Version 1.84 + +* Reverted back the upgrader class so that it still works on Civi 5.37 # Version 1.83 diff --git a/dataprocessor.civix.php b/dataprocessor.civix.php index 5762a2ac15db083c1d0de7e12dba2490ad681e93..19b46304a1505a6116dae654c0bd78e9edb45f60 100644 --- a/dataprocessor.civix.php +++ b/dataprocessor.civix.php @@ -104,7 +104,35 @@ function _dataprocessor_civix_civicrm_config($config = NULL) { */ function _dataprocessor_civix_civicrm_install() { _dataprocessor_civix_civicrm_config(); - // Based on <compatibility>, this does not currently require mixin/polyfill.php. + if ($upgrader = _dataprocessor_civix_upgrader()) { + $upgrader->onInstall(); + } +} + +/** + * Implements hook_civicrm_postInstall(). + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall + */ +function _dataprocessor_civix_civicrm_postInstall() { + _dataprocessor_civix_civicrm_config(); + if ($upgrader = _dataprocessor_civix_upgrader()) { + if (is_callable([$upgrader, 'onPostInstall'])) { + $upgrader->onPostInstall(); + } + } +} + +/** + * Implements hook_civicrm_uninstall(). + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall + */ +function _dataprocessor_civix_civicrm_uninstall() { + _dataprocessor_civix_civicrm_config(); + if ($upgrader = _dataprocessor_civix_upgrader()) { + $upgrader->onUninstall(); + } } /** @@ -112,11 +140,61 @@ function _dataprocessor_civix_civicrm_install() { * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable */ -function _dataprocessor_civix_civicrm_enable(): void { +function _dataprocessor_civix_civicrm_enable() { _dataprocessor_civix_civicrm_config(); - // Based on <compatibility>, this does not currently require mixin/polyfill.php. + if ($upgrader = _dataprocessor_civix_upgrader()) { + if (is_callable([$upgrader, 'onEnable'])) { + $upgrader->onEnable(); + } + } +} + +/** + * (Delegated) Implements hook_civicrm_disable(). + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable + * @return mixed + */ +function _dataprocessor_civix_civicrm_disable() { + _dataprocessor_civix_civicrm_config(); + if ($upgrader = _dataprocessor_civix_upgrader()) { + if (is_callable([$upgrader, 'onDisable'])) { + $upgrader->onDisable(); + } + } +} + +/** + * (Delegated) Implements hook_civicrm_upgrade(). + * + * @param $op string, the type of operation being performed; 'check' or 'enqueue' + * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks + * + * @return mixed + * based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending) + * for 'enqueue', returns void + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade + */ +function _dataprocessor_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { + if ($upgrader = _dataprocessor_civix_upgrader()) { + return $upgrader->onUpgrade($op, $queue); + } } +/** + * @return CRM_Dataprocessor_Upgrader + */ +function _dataprocessor_civix_upgrader() { + if (!file_exists(__DIR__ . '/CRM/Dataprocessor/Upgrader.php')) { + return NULL; + } + else { + return CRM_Dataprocessor_Upgrader_Base::instance(); + } +} + + /** * Inserts a navigation menu item at a given place in the hierarchy. * diff --git a/dataprocessor.php b/dataprocessor.php index 690c66e320d008a724afa923cf22524843ad77f1..f5de00f811a7f69968a3a3b934cbf89675ff1903 100644 --- a/dataprocessor.php +++ b/dataprocessor.php @@ -244,6 +244,25 @@ function dataprocessor_civicrm_install() { _dataprocessor_civix_civicrm_install(); } +/** + * Implements hook_civicrm_postInstall(). + * + * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_postInstall + */ +function dataprocessor_civicrm_postInstall() { + _dataprocessor_civix_civicrm_postInstall(); +} + +/** + * Implements hook_civicrm_uninstall(). + * + * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall + */ +function dataprocessor_civicrm_uninstall() { + _dataprocessor_civix_civicrm_uninstall(); +} + + /** * Implements hook_civicrm_enable(). * @@ -253,6 +272,25 @@ function dataprocessor_civicrm_enable() { _dataprocessor_civix_civicrm_enable(); } +/** + * Implements hook_civicrm_disable(). + * + * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable + */ +function dataprocessor_civicrm_disable() { + _dataprocessor_civix_civicrm_disable(); +} + +/** + * Implements hook_civicrm_upgrade(). + * + * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_upgrade + */ +function dataprocessor_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { + return _dataprocessor_civix_civicrm_upgrade($op, $queue); +} + + /** * Implements hook_civicrm_xmlMenu(). * diff --git a/info.xml b/info.xml index 2a40bd9d564d2d2452a7f8ae96d850736aee821b..c1ca2b50caece84c4eb8df9f6ca3fc17b741e36f 100644 --- a/info.xml +++ b/info.xml @@ -15,7 +15,7 @@ <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url> </urls> <releaseDate>2023-09-21</releaseDate> - <version>1.84-dev</version> + <version>1.84</version> <develStage>stable</develStage> <compatibility> <ver>5.37</ver>