Do not fatal on missing extensions
authoreileen <emcnaughton@wikimedia.org>
Sat, 5 Oct 2019 09:11:54 +0000 (11:11 +0200)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:19 +0000 (19:13 -0700)
Currently a missing extension will lead to a complete fatal on afforms. We can ignore these in the
extensions, missing extensions are otherwise notified in corre

ext/afform/core/CRM/Afform/AfformScanner.php

index 2c5f86c1f3823218b9b976c65a1671ae8e08865f..589602369d51787ff4451ffbe8247c089d636bf8 100644 (file)
@@ -55,8 +55,13 @@ class CRM_Afform_AfformScanner {
     $mapper = CRM_Extension_System::singleton()->getMapper();
     foreach ($mapper->getModules() as $module) {
       /** @var $module CRM_Core_Module */
-      if ($module->is_active) {
-        $this->appendFilePaths($paths, dirname($mapper->keyToPath($module->name)) . DIRECTORY_SEPARATOR . 'ang', 20);
+      try {
+        if ($module->is_active) {
+          $this->appendFilePaths($paths, dirname($mapper->keyToPath($module->name)) . DIRECTORY_SEPARATOR . 'ang', 20);
+        }
+      }
+      catch (CRM_Extension_Exception_MissingException $e) {
+        // If the extension is missing skip & continue.
       }
     }