diff --git a/CRM/Admin/Page/Extensions.php b/CRM/Admin/Page/Extensions.php
index d3ec1aae6373..e845def26c48 100644
--- a/CRM/Admin/Page/Extensions.php
+++ b/CRM/Admin/Page/Extensions.php
@@ -155,6 +155,7 @@ public function formatLocalExtensionRows() {
$keys = array_keys($manager->getStatuses());
sort($keys);
$hiddenExtensions = $mapper->getKeysByTag('mgmt:hidden');
+ $requiredExtensions = $mapper->getKeysByTag('mgmt:required');
foreach ($keys as $key) {
if (in_array($key, $hiddenExtensions)) {
continue;
@@ -202,7 +203,7 @@ public function formatLocalExtensionRows() {
}
// TODO if extbrowser is enabled and extbrowser has newer version than extcontainer,
// then $action += CRM_Core_Action::UPDATE
- if ($action) {
+ if ($action && !in_array($key, $requiredExtensions)) {
$row['action'] = CRM_Core_Action::formLink(self::links(),
$action,
['id' => $row['id'], 'key' => $obj->key],
diff --git a/CRM/Extension/Manager.php b/CRM/Extension/Manager.php
index 86c8bbec6c6f..b64bcc23f129 100644
--- a/CRM/Extension/Manager.php
+++ b/CRM/Extension/Manager.php
@@ -378,6 +378,9 @@ public function disable($keys) {
sort($keys);
$disableRequirements = $this->findDisableRequirements($keys);
+
+ $requiredExtensions = $this->mapper->getKeysByTag('mgmt:required');
+
// This munges order, but makes it comparable.
sort($disableRequirements);
if ($keys !== $disableRequirements) {
@@ -388,6 +391,10 @@ public function disable($keys) {
foreach ($keys as $key) {
if (isset($origStatuses[$key])) {
+ if (in_array($key, $requiredExtensions)) {
+ throw new CRM_Extension_Exception("Cannot disable required extension: $key");
+ }
+
switch ($origStatuses[$key]) {
case self::STATUS_INSTALLED:
$this->addProcess([$key], 'disabling');
diff --git a/CRM/Extension/System.php b/CRM/Extension/System.php
index 60cf564bca1d..39854cec2479 100644
--- a/CRM/Extension/System.php
+++ b/CRM/Extension/System.php
@@ -340,6 +340,7 @@ public static function createExtendedInfo(CRM_Extension_Info $obj) {
$extensionRow['path'] = '';
}
$extensionRow['status'] = $manager->getStatus($obj->key);
+ $requiredExtensions = $mapper->getKeysByTag('mgmt:required');
switch ($extensionRow['status']) {
case CRM_Extension_Manager::STATUS_UNINSTALLED:
@@ -371,6 +372,9 @@ public static function createExtendedInfo(CRM_Extension_Info $obj) {
if ($manager->isIncompatible($obj->key)) {
$extensionRow['statusLabel'] = ts('Obsolete') . ($extensionRow['statusLabel'] ? (' - ' . $extensionRow['statusLabel']) : '');
}
+ elseif (in_array($obj->key, $requiredExtensions)) {
+ $extensionRow['statusLabel'] = ts('Required');
+ }
return $extensionRow;
}
diff --git a/CRM/Upgrade/Incremental/php/FiveFiftySeven.php b/CRM/Upgrade/Incremental/php/FiveFiftySeven.php
index 71753805d18a..f050f3dd5684 100644
--- a/CRM/Upgrade/Incremental/php/FiveFiftySeven.php
+++ b/CRM/Upgrade/Incremental/php/FiveFiftySeven.php
@@ -29,6 +29,7 @@ class CRM_Upgrade_Incremental_php_FiveFiftySeven extends CRM_Upgrade_Incremental
*/
public function upgrade_5_57_alpha1($rev): void {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+ $this->addExtensionTask('Enable SearchKit extension', ['org.civicrm.search_kit']);
}
}
diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php
index 43eea9c43190..4d697af39684 100644
--- a/CRM/Utils/Check/Component/Env.php
+++ b/CRM/Utils/Check/Component/Env.php
@@ -603,6 +603,7 @@ public function checkExtensions() {
$enabled = array_keys(array_filter($stauses, function($status) {
return $status === CRM_Extension_Manager::STATUS_INSTALLED;
}));
+ $requiredExtensions = $mapper->getKeysByTag('mgmt:required');
sort($keys);
$updates = $errors = $okextensions = [];
@@ -660,6 +661,24 @@ public function checkExtensions() {
}
}
break;
+
+ default:
+ if (in_array($key, $requiredExtensions, TRUE)) {
+ $requiredMessage = new CRM_Utils_Check_Message(
+ __FUNCTION__ . 'Required:' . $key,
+ ts('The extension %1 is required and must be enabled.', [1 => $row['label']]),
+ ts('Required Extension'),
+ \Psr\Log\LogLevel::ERROR,
+ 'fa-exclamation-triangle'
+ );
+ $requiredMessage->addAction(
+ ts('Enable %1', [1 => $row['label']]),
+ '',
+ 'api3',
+ ['Extension', 'install', ['key' => $key]]
+ );
+ $messages[] = $requiredMessage;
+ }
}
}
diff --git a/bin/regen.sh b/bin/regen.sh
index 57309fe10436..46e7d6d2418e 100755
--- a/bin/regen.sh
+++ b/bin/regen.sh
@@ -47,7 +47,7 @@ php GenerateData.php
## Prune local data
$MYSQLCMD -e "DROP TABLE IF EXISTS civicrm_install_canary; DELETE FROM civicrm_cache; DELETE FROM civicrm_setting;"
-$MYSQLCMD -e "DELETE FROM civicrm_extension WHERE full_name NOT IN ('sequentialcreditnotes', 'eventcart', 'greenwich', 'search', 'org.civicrm.flexmailer', 'financialacls', 'contributioncancelactions', 'recaptcha', 'ckeditor4', 'legacycustomsearches', 'civiimport');"
+$MYSQLCMD -e "DELETE FROM civicrm_extension WHERE full_name NOT IN ('sequentialcreditnotes', 'eventcart', 'greenwich', 'org.civicrm.search_kit', 'org.civicrm.flexmailer', 'financialacls', 'contributioncancelactions', 'recaptcha', 'ckeditor4', 'legacycustomsearches', 'civiimport');"
TABLENAMES=$( echo "show tables like 'civicrm_%'" | $MYSQLCMD | grep ^civicrm_ | xargs )
cd $CIVISOURCEDIR/sql
diff --git a/ext/search_kit/info.xml b/ext/search_kit/info.xml
index c08626753d84..a5b7eb5cb6fb 100644
--- a/ext/search_kit/info.xml
+++ b/ext/search_kit/info.xml
@@ -17,10 +17,13 @@
2021-01-06
5.57.alpha1
stable
+
+ mgmt:required
+
5.57
- This extension is still in beta. Click on the chat link above to discuss development, report problems or ask questions.
+ Click on the chat link above to discuss development, report problems or ask questions.