Skip to content
Snippets Groups Projects
Commit cd9a9991 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5605: coding standards

parent 2b6a75eb
No related branches found
No related tags found
1 merge request!247Feature/istwcms 5605 ebremner migration clean up
...@@ -4,6 +4,8 @@ namespace Drupal\uw_cfg_common\Commands; ...@@ -4,6 +4,8 @@ namespace Drupal\uw_cfg_common\Commands;
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandler;
use Drupal\Core\Extension\ModuleInstaller;
use Drupal\uw_cfg_common\Service\UWMissingBlocks; use Drupal\uw_cfg_common\Service\UWMissingBlocks;
use Drupal\uw_cfg_common\UwPermissions\UwPermissions; use Drupal\uw_cfg_common\UwPermissions\UwPermissions;
use Drupal\uw_cfg_common\UwRoles\UwRoles; use Drupal\uw_cfg_common\UwRoles\UwRoles;
...@@ -38,13 +40,35 @@ class UwDrushCommands extends DrushCommands { ...@@ -38,13 +40,35 @@ class UwDrushCommands extends DrushCommands {
*/ */
protected $configFactory; protected $configFactory;
/**
* Module handler.
*
* @var \Drupal\Core\Extension\ModuleHandler
*/
protected $moduleHandler;
/**
* Module installer.
*
* @var \Drupal\Core\Extension\ModuleInstaller
*/
protected $moduleInstaller;
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function __construct(EntityTypeManagerInterface $entityTypeManager, UWMissingBlocks $missingBlocks, ConfigFactoryInterface $configFactory) { public function __construct(
EntityTypeManagerInterface $entityTypeManager,
UWMissingBlocks $missingBlocks,
ConfigFactoryInterface $configFactory,
ModuleHandler $moduleHandler,
ModuleInstaller $moduleInstaller
) {
$this->entityTypeManager = $entityTypeManager; $this->entityTypeManager = $entityTypeManager;
$this->missingBlocks = $missingBlocks; $this->missingBlocks = $missingBlocks;
$this->configFactory = $configFactory; $this->configFactory = $configFactory;
$this->moduleHandler = $moduleHandler;
$this->moduleInstaller = $moduleInstaller;
} }
/** /**
...@@ -240,7 +264,7 @@ class UwDrushCommands extends DrushCommands { ...@@ -240,7 +264,7 @@ class UwDrushCommands extends DrushCommands {
$modules = [ $modules = [
'uw_migrate', 'uw_migrate',
'webform_migrate', 'webform_migrate',
'webform_node' 'webform_node',
]; ];
// Step through each of the modules, ensure that they // Step through each of the modules, ensure that they
...@@ -248,10 +272,10 @@ class UwDrushCommands extends DrushCommands { ...@@ -248,10 +272,10 @@ class UwDrushCommands extends DrushCommands {
foreach ($modules as $module) { foreach ($modules as $module) {
// If the module is enabled, uninstall it. // If the module is enabled, uninstall it.
if (\Drupal::service('module_handler')->moduleExists($module)) { if ($this->moduleHandler->moduleExists($module)) {
// Uninstall the module. // Uninstall the module.
\Drupal::service('module_installer')->uninstall([$module]); $this->moduleInstaller->uninstall([$module]);
// Log to the screen. // Log to the screen.
$this->logger()->success('Uninstalled: ' . $module); $this->logger()->success('Uninstalled: ' . $module);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment