ObsoleteExtensionException example

$extension_config = \Drupal::configFactory()->getEditable('core.extension');
    // Get all module data so we can find dependencies and sort and find the     // core requirements. The module list needs to be reset so that it can     // re-scan and include any new modules that may have been added directly     // into the filesystem.     $module_data = \Drupal::service('extension.list.module')->reset()->getList();
    foreach ($module_list as $module) {
      if (!empty($module_data[$module]->info['core_incompatible'])) {
        throw new MissingDependencyException("Unable to install modules: module '$module' is incompatible with this version of Drupal core.");
      }
      if ($module_data[$module]->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::OBSOLETE) {
        throw new ObsoleteExtensionException("Unable to install modules: module '$module' is obsolete.");
      }
      if ($module_data[$module]->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) {
        @trigger_error("The module '$module' is deprecated. See " . $module_data[$module]->info['lifecycle_link'], E_USER_DEPRECATED);
      }
    }
    if ($enable_dependencies) {
      $module_list = $module_list ? array_combine($module_list$module_list) : [];
      if ($missing_modules = array_diff_key($module_list$module_data)) {
        // One or more of the given modules doesn't exist.         throw new MissingDependencyException(sprintf('Unable to install modules %s due to missing modules %s.', implode(', ', $module_list)implode(', ', $missing_modules)));
      }

      
Home | Imprint | This part of the site doesn't use cookies.