From adcb730a966848fd3bf31c234bd61a31bc18b902 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 21 Jul 2022 16:54:55 -0700 Subject: [PATCH] Upgrader - Show additional notice about running extension upgrades --- CRM/Upgrade/Form.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/CRM/Upgrade/Form.php b/CRM/Upgrade/Form.php index c16857ded3..4d950c66ac 100644 --- a/CRM/Upgrade/Form.php +++ b/CRM/Upgrade/Form.php @@ -599,6 +599,13 @@ SET version = '$version' ); $queue->createItem($task, ['weight' => 1000]); + $task = new CRM_Queue_Task( + ['CRM_Upgrade_Form', 'doFinalMessages'], + [$currentVer, $latestVer, $postUpgradeMessageFile], + 'Generate final messages' + ); + $queue->createItem($task, ['weight' => 3000]); + return $queue; } @@ -832,6 +839,34 @@ SET version = '$version' return TRUE; } + /** + * Generate any standard post-upgrade messages (which are not version-specific). + * + * @param \CRM_Queue_TaskContext $ctx + * @param string $originalVer + * the original revision. + * @param string $latestVer + * the target (final) revision. + * @param string $postUpgradeMessageFile + * path of a modifiable file which lists the post-upgrade messages. + * + * @return bool + */ + public static function doFinalMessages(CRM_Queue_TaskContext $ctx, $originalVer, $latestVer, $postUpgradeMessageFile): bool { + // NOTE: This step should be automated circa 5.53. + $originalMajorMinor = array_slice(explode('.', $originalVer), 0, 2); + $latestMajorMinor = array_slice(explode('.', $latestVer), 0, 2); + if ($originalMajorMinor !== $latestMajorMinor) { + file_put_contents($postUpgradeMessageFile, + '

' . ts('WARNING: Core extensions may also require database updates. Please execute extension updates immediately.', [ + 1 => sprintf('href="%s" target="_blank" ', CRM_Utils_System::url('civicrm/admin/extensions/upgrade', 'reset=1', TRUE)), + ]), + FILE_APPEND + ); + } + return TRUE; + } + /** * After finishing the queue, the upgrade-runner calls `doFinish()`. * -- 2.25.1