Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(REF) CRM_Upgrade_Headless - The pre-up and post-up msgs should have same formatting #25488

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
];
}

}