(dev/core#4391) Prohibit uninstallation of core components
authorTim Otten <totten@civicrm.org>
Wed, 5 Jul 2023 19:42:47 +0000 (12:42 -0700)
committerSeamus Lee <seamuslee001@gmail.com>
Thu, 6 Jul 2023 21:01:06 +0000 (07:01 +1000)
CRM/Extension/Manager.php

index 6b1f1cfb598ff8a2c3415c9d438b9b5ab77b7942..921983dd145922c167110a801596aa5b5d17e79c 100644 (file)
@@ -455,6 +455,12 @@ class CRM_Extension_Manager {
     // TODO: to mitigate the risk of crashing during installation, scan
     // keys/statuses/types before doing anything
 
+    // Component data still lives inside of core-core. Uninstalling is nonsensical.
+    $notUninstallable = array_intersect($keys, $this->mapper->getKeysByTag('component'));
+    if (count($notUninstallable)) {
+      throw new CRM_Extension_Exception("Cannot uninstall extensions which are tagged as components: " . implode(', ', $notUninstallable));
+    }
+
     $this->addProcess($keys, 'uninstall');
 
     foreach ($keys as $key) {