standaloneusers - Slightly relax install check to allow headless.
authorTim Otten <totten@civicrm.org>
Sat, 24 Jun 2023 22:48:51 +0000 (15:48 -0700)
committerTim Otten <totten@civicrm.org>
Sat, 24 Jun 2023 23:08:59 +0000 (16:08 -0700)
ext/standaloneusers/CRM/Standaloneusers/Upgrader.php

index d27e801797eb9bfdbae1d4405f303d267c619474..ecde5dc978065c0408b728426bf2e2b811a6c55c 100644 (file)
@@ -17,10 +17,11 @@ class CRM_Standaloneusers_Upgrader extends CRM_Extension_Upgrader_Base {
    */
   public function onInstall() {
     $config = \CRM_Core_Config::singleton();
-    if (!($config->userPermissionClass instanceof \CRM_Core_Permission_Standalone)) {
+    // We generally only want to run on standalone. In theory, we might also run headless tests.
+    if (!in_array(get_class($config->userPermissionClass), ['CRM_Core_Permission_Standalone', 'CRM_Core_Permission_Headless'])) {
       throw new \CRM_Core_Exception("standaloneusers can only be installed on standalone");
     }
-    if (!($config->userSystem instanceof \CRM_Utils_System_Standalone)) {
+    if (!in_array(get_class($config->userSystem), ['CRM_Utils_System_Standalone', 'CRM_Utils_System_Headless'])) {
       throw new \CRM_Core_Exception("standaloneusers can only be installed on standalone");
     }
     parent::onInstall();