You are here

class ModuleBlacklistModuleInstaller in Module Blacklist 8

Class ModuleBlacklistModuleInstaller.

@package Drupal\module_blacklist

Hierarchy

Expanded class hierarchy of ModuleBlacklistModuleInstaller

1 string reference to 'ModuleBlacklistModuleInstaller'
module_blacklist.services.yml in ./module_blacklist.services.yml
module_blacklist.services.yml
1 service uses ModuleBlacklistModuleInstaller
module_blacklist.module_installer in ./module_blacklist.services.yml
Drupal\module_blacklist\ModuleBlacklistModuleInstaller

File

src/ModuleBlacklistModuleInstaller.php, line 12

Namespace

Drupal\module_blacklist
View source
class ModuleBlacklistModuleInstaller extends ModuleInstaller {

  /**
   * Performs module pre-install rollback operations.
   *
   * This method performs rollback operations for module installation process
   * executed before the invocation of the hook hook_module_preinstall().
   *
   * @param string $module
   *   The module name.
   */
  public function rollbackPreinstall($module) {

    // Remove the module's entry from the config. Don't check schema when
    // uninstalling a module since we are only clearing a key.
    \Drupal::configFactory()
      ->getEditable('core.extension')
      ->clear("module.{$module}")
      ->save(TRUE);

    // Update the module handler to remove the pre-installed module.
    $module_filenames = $this->moduleHandler
      ->getModuleList();
    unset($module_filenames[$module]);
    $this->moduleHandler
      ->setModuleList($module_filenames);

    // Clear the static cache of system_rebuild_module_data() to pick up the
    // new module, since it merges the installation status of modules into
    // its statically cached list.
    drupal_static_reset('system_rebuild_module_data');

    // Update the kernel to exclude the uninstalled modules.
    $this
      ->updateKernel($module_filenames);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ModuleBlacklistModuleInstaller::rollbackPreinstall public function Performs module pre-install rollback operations.
ModuleInstaller::$kernel protected property The drupal kernel.
ModuleInstaller::$moduleHandler protected property The module handler.
ModuleInstaller::$root protected property The app root.
ModuleInstaller::$uninstallValidators protected property The uninstall validators.
ModuleInstaller::addUninstallValidator public function Adds module a uninstall validator. Overrides ModuleInstallerInterface::addUninstallValidator
ModuleInstaller::install public function Installs a given list of modules. Overrides ModuleInstallerInterface::install
ModuleInstaller::removeCacheBins protected function Helper method for removing all cache bins registered by a given module.
ModuleInstaller::uninstall public function Uninstalls a given list of modules. Overrides ModuleInstallerInterface::uninstall
ModuleInstaller::updateKernel protected function Updates the kernel module list.
ModuleInstaller::validateUninstall public function Determines whether a list of modules can be uninstalled. Overrides ModuleInstallerInterface::validateUninstall
ModuleInstaller::__construct public function Constructs a new ModuleInstaller instance.