From 97b2f56b53c3b6005d7a2cc4def0b4aef5f9ba68 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 17 Jan 2023 10:18:28 +1300 Subject: [PATCH] Civix upgrade message_admin --- ext/message_admin/info.xml | 2 +- ext/message_admin/message_admin.civix.php | 94 ++--------------------- ext/message_admin/message_admin.php | 36 --------- 3 files changed, 6 insertions(+), 126 deletions(-) diff --git a/ext/message_admin/info.xml b/ext/message_admin/info.xml index 802b24e46f..cc8bdbd41a 100644 --- a/ext/message_admin/info.xml +++ b/ext/message_admin/info.xml @@ -34,6 +34,6 @@ CRM/MessageAdmin - 22.10.0 + 22.12.1 diff --git a/ext/message_admin/message_admin.civix.php b/ext/message_admin/message_admin.civix.php index 14af7812f4..b386a62dc7 100644 --- a/ext/message_admin/message_admin.civix.php +++ b/ext/message_admin/message_admin.civix.php @@ -84,27 +84,20 @@ use CRM_MessageAdmin_ExtensionUtil as E; * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config */ -function _message_admin_civix_civicrm_config(&$config = NULL) { +function _message_admin_civix_civicrm_config($config = NULL) { static $configured = FALSE; if ($configured) { return; } $configured = TRUE; - $template = CRM_Core_Smarty::singleton(); - $extRoot = __DIR__ . DIRECTORY_SEPARATOR; $extDir = $extRoot . 'templates'; - - if (is_array($template->template_dir)) { - array_unshift($template->template_dir, $extDir); - } - else { - $template->template_dir = [$extDir, $template->template_dir]; - } + CRM_Core_Smarty::singleton()->addTemplateDir($extDir); $include_path = $extRoot . PATH_SEPARATOR . get_include_path(); set_include_path($include_path); + // Based on , this does not currently require mixin/polyfill.php. } /** @@ -114,35 +107,7 @@ function _message_admin_civix_civicrm_config(&$config = NULL) { */ function _message_admin_civix_civicrm_install() { _message_admin_civix_civicrm_config(); - if ($upgrader = _message_admin_civix_upgrader()) { - $upgrader->onInstall(); - } -} - -/** - * Implements hook_civicrm_postInstall(). - * - * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall - */ -function _message_admin_civix_civicrm_postInstall() { - _message_admin_civix_civicrm_config(); - if ($upgrader = _message_admin_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 _message_admin_civix_civicrm_uninstall(): void { - _message_admin_civix_civicrm_config(); - if ($upgrader = _message_admin_civix_upgrader()) { - $upgrader->onUninstall(); - } + // Based on , this does not currently require mixin/polyfill.php. } /** @@ -152,56 +117,7 @@ function _message_admin_civix_civicrm_uninstall(): void { */ function _message_admin_civix_civicrm_enable(): void { _message_admin_civix_civicrm_config(); - if ($upgrader = _message_admin_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 _message_admin_civix_civicrm_disable(): void { - _message_admin_civix_civicrm_config(); - if ($upgrader = _message_admin_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 _message_admin_civix_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { - if ($upgrader = _message_admin_civix_upgrader()) { - return $upgrader->onUpgrade($op, $queue); - } -} - -/** - * @return CRM_MessageAdmin_Upgrader - */ -function _message_admin_civix_upgrader() { - if (!file_exists(__DIR__ . '/CRM/MessageAdmin/Upgrader.php')) { - return NULL; - } - else { - return CRM_MessageAdmin_Upgrader_Base::instance(); - } + // Based on , this does not currently require mixin/polyfill.php. } /** diff --git a/ext/message_admin/message_admin.php b/ext/message_admin/message_admin.php index 4f9bd7b475..872e322729 100644 --- a/ext/message_admin/message_admin.php +++ b/ext/message_admin/message_admin.php @@ -23,24 +23,6 @@ function message_admin_civicrm_install() { _message_admin_civix_civicrm_install(); } -/** - * Implements hook_civicrm_postInstall(). - * - * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall - */ -function message_admin_civicrm_postInstall() { - _message_admin_civix_civicrm_postInstall(); -} - -/** - * Implements hook_civicrm_uninstall(). - * - * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_uninstall - */ -function message_admin_civicrm_uninstall() { - _message_admin_civix_civicrm_uninstall(); -} - /** * Implements hook_civicrm_enable(). * @@ -50,24 +32,6 @@ function message_admin_civicrm_enable() { _message_admin_civix_civicrm_enable(); } -/** - * Implements hook_civicrm_disable(). - * - * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_disable - */ -function message_admin_civicrm_disable() { - _message_admin_civix_civicrm_disable(); -} - -/** - * Implements hook_civicrm_upgrade(). - * - * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_upgrade - */ -function message_admin_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { - return _message_admin_civix_civicrm_upgrade($op, $queue); -} - /** * Implements hook_civicrm_entityTypes(). * -- 2.25.1