Skip to content

Commit

Permalink
Merge pull request #25488 from totten/master-headless-return
Browse files Browse the repository at this point in the history
(REF) CRM_Upgrade_Headless - The pre-up and post-up msgs should have same formatting
  • Loading branch information
seamuslee001 authored Feb 1, 2023
2 parents 4272725 + f9d5683 commit 886b35f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions CRM/Upgrade/Headless.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class CRM_Upgrade_Headless {
/**
* Pre Upgrade Message
* @var string
* HTML-formatted message
*/
private $preUpgradeMessage;

Expand Down Expand Up @@ -77,11 +78,14 @@ public function run($enablePrint = TRUE) {
}

/**
* Get the PreUpgrade message
* @return string
* Get the pre-upgrade message.
*
* @return array
* The upgrade message, in HTML and text formats.
* Ex: ['message' => '<p>Foo</p><b>Bar</p>', 'text' => ["Foo\n\nBar"]]
* @throws \Exception
*/
public function getPreUpgradeMessage(): string {
public function getPreUpgradeMessage(): array {
$upgrade = new CRM_Upgrade_Form();
[$currentVer, $latestVer] = $upgrade->getUpgradeVersions();

Expand All @@ -94,7 +98,10 @@ public function getPreUpgradeMessage(): string {
$upgrade->setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
$this->preUpgradeMessage = $preUpgradeMessage;
}
return $this->preUpgradeMessage;
return [
'message' => $this->preUpgradeMessage,
'text' => CRM_Utils_String::htmlToText($this->preUpgradeMessage),
];
}

}

0 comments on commit 886b35f

Please sign in to comment.