Extensions - In case of dirty removal, skip classloader
authorTim Otten <totten@civicrm.org>
Wed, 21 Apr 2021 19:28:22 +0000 (12:28 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 21 Apr 2021 19:28:22 +0000 (12:28 -0700)
CRM/Extension/Manager/Module.php

index f4ce5ceb78634a1aa16be3213c24c42a32649bd1..4dc170aaf35539523a8c6375198e98888c6c1b5b 100644 (file)
@@ -101,7 +101,16 @@ class CRM_Extension_Manager_Module extends CRM_Extension_Manager_Base {
    * @param CRM_Extension_Info $info
    */
   private function registerClassloader($info) {
-    CRM_Extension_System::singleton()->getClassLoader()->installExtension($info, dirname($this->mapper->keyToPath($info->key)));
+    try {
+      $extPath = dirname($this->mapper->keyToPath($info->key));
+    }
+    catch (CRM_Extension_Exception_MissingException $e) {
+      // This could happen if there was a dirty removal (i.e. deleting ext-code before uninstalling).
+      return;
+    }
+
+    $classloader = CRM_Extension_System::singleton()->getClassLoader();
+    $classloader->installExtension($info, $extPath);
   }
 
 }