diff --git a/commands/core/core.drush.inc b/commands/core/core.drush.inc index a307d9d9a5..f3a9c93c54 100644 --- a/commands/core/core.drush.inc +++ b/commands/core/core.drush.inc @@ -29,22 +29,3 @@ function core_drush_help($section) { break; } } - -/** - * Implementation of hook_drush_engine_type_info(). - */ -function core_drush_engine_type_info() { - $info = array(); - $info['drupal'] = array(); - return $info; -} - -/** - * Implements hook_drush_engine_ENGINE_TYPE(). - */ -function core_drush_engine_drupal() { - $engines = array( - 'environment' => array(), - ); - return $engines; -} diff --git a/commands/core/drupal/environment.inc b/commands/core/drupal/environment.inc deleted file mode 100644 index 452370fa34..0000000000 --- a/commands/core/drupal/environment.inc +++ /dev/null @@ -1,44 +0,0 @@ -getModuleList()); - return array_combine($modules, $modules); -} - -/** - * Determines which modules are implementing a hook. - * - * @param string $hook - * The hook name. - * @param bool $sort - * Not used in Drupal 8 environment. - * @param bool $reset - * TRUE to reset the hook implementation cache. - * - * @see \Drupal\Core\Extension\ModuleHandlerInterface::getImplementations(). - * @see \Drupal\Core\Extension\ModuleHandlerInterface::resetImplementations(). - * - */ -function drush_module_implements($hook, $sort = FALSE, $reset = FALSE) { - // $sort is there for consistency, but looks like Drupal 8 has no equilavient for it. - // We can sort the list manually later if really needed. - if ($reset == TRUE){ - \Drupal::moduleHandler()->resetImplementations(); - } - return \Drupal::moduleHandler()->getImplementations($hook); -} diff --git a/includes/batch.inc b/includes/batch.inc index 0f736c9dde..425b2e1532 100644 --- a/includes/batch.inc +++ b/includes/batch.inc @@ -132,7 +132,6 @@ function _drush_backend_batch_process($command = 'batch-process', $args, $option _batch_populate_queue($batch, $key); } - drush_include_engine('drupal', 'environment'); // Store the batch. /** @var \Drupal\Core\Batch\BatchStorage $batch_storage */ $batch_storage = \Drupal::service('batch.storage'); diff --git a/src/Boot/DrupalBoot.php b/src/Boot/DrupalBoot.php index 8206644de7..4e7d64736f 100644 --- a/src/Boot/DrupalBoot.php +++ b/src/Boot/DrupalBoot.php @@ -161,11 +161,13 @@ function commandfile_searchpaths($phase, $phase_max = FALSE) { // Add enabled module paths, excluding the install profile. Since we are bootstrapped, // we can use the Drupal API. $ignored_modules = drush_get_option_list('ignored-modules', array()); + $modules = array_keys(\Drupal::moduleHandler()->getModuleList()); + $module_list = array_combine($modules, $modules); $cid = drush_cid_install_profile(); if ($cached = drush_cache_get($cid)) { $ignored_modules[] = $cached->data; } - foreach (array_diff(drush_module_list(), $ignored_modules) as $module) { + foreach (array_diff($module_list, $ignored_modules) as $module) { $filepath = drupal_get_path('module', $module); if ($filepath && $filepath != '/') { $searchpath[] = $filepath; @@ -558,7 +560,6 @@ function bootstrap_drupal_database() { * Attempt to load the full Drupal system. */ function bootstrap_drupal_full() { - drush_include_engine('drupal', 'environment'); $this->add_logger(); diff --git a/src/Boot/DrupalBoot6.php b/src/Boot/DrupalBoot6.php index 282fefc788..9f669c953f 100644 --- a/src/Boot/DrupalBoot6.php +++ b/src/Boot/DrupalBoot6.php @@ -16,7 +16,7 @@ function valid_root($path) { // Drupal 6 root. // We check for the absence of 'modules/field/field.module' to differentiate this from a D7 site. // n.b. we want D5 and earlier to match here, if possible, so that we can print a 'not supported' - // error durring bootstrap. If someone later adds a commandfile that adds a boot class for + // error during bootstrap. If someone later adds a commandfile that adds a boot class for // Drupal 5, it will be tested first, so we shouldn't get here. $candidate = 'includes/common.inc'; if (file_exists($path . '/' . $candidate) && file_exists($path . '/misc/drupal.js') && !file_exists($path . '/modules/field/field.module')) { @@ -39,14 +39,7 @@ function get_profile() { return variable_get('install_profile', 'standard'); } - function add_logger() { - // If needed, prod module_implements() to recognize our system_watchdog() implementation. - $dogs = drush_module_implements('watchdog'); - if (!in_array('system', $dogs)) { - // Note that this resets module_implements cache. - drush_module_implements('watchdog', FALSE, TRUE); - } - } + function add_logger() {} function contrib_modules_paths() { return array( diff --git a/src/Boot/DrupalBoot7.php b/src/Boot/DrupalBoot7.php index 1065679f75..de095d6d9c 100644 --- a/src/Boot/DrupalBoot7.php +++ b/src/Boot/DrupalBoot7.php @@ -31,20 +31,7 @@ function get_profile() { return drupal_get_profile(); } - function add_logger() { - // If needed, prod module_implements() to recognize our system_watchdog() implementation. - $dogs = drush_module_implements('watchdog'); - if (!in_array('system', $dogs)) { - // Note that we must never clear the module_implements() cache because - // that would trigger larger cache rebuilds with system_cache_tables on - // every drush invocation. Instead we inject our system_watchdog() - // implementation direclty into the static cache. - $implementations = &drupal_static('module_implements'); - $implementations['watchdog']['system'] = FALSE; - $verified_implementations = &drupal_static('module_implements:verified'); - $verified_implementations['watchdog'] = TRUE; - } - } + function add_logger() {} function contrib_modules_paths() { return array( diff --git a/src/Commands/core/CacheCommands.php b/src/Commands/core/CacheCommands.php index 8eb881793f..ec66b370e8 100644 --- a/src/Commands/core/CacheCommands.php +++ b/src/Commands/core/CacheCommands.php @@ -253,10 +253,6 @@ function getTypes($include_bootstrapped_types = FALSE) { ); } - // Include the appropriate environment engine, so callbacks can use core - // version specific cache clearing functions directly. - drush_include_engine('drupal', 'environment'); - // Command files may customize $types as desired. $handlers = $this->getCustomEventHandlers('cache-clear', $types, $include_bootstrapped_types); foreach ($handlers as $handler) { diff --git a/src/Commands/core/CoreCommands.php b/src/Commands/core/CoreCommands.php index 5824611e9d..fd854b37ef 100644 --- a/src/Commands/core/CoreCommands.php +++ b/src/Commands/core/CoreCommands.php @@ -42,11 +42,13 @@ public function twigCompile() { // Scan all enabled modules and themes. // @todo refactor since \Drush\Boot\DrupalBoot::commandfile_searchpaths is similar. $ignored_modules = drush_get_option_list('ignored-modules', array()); + $modules = array_keys(\Drupal::moduleHandler()->getModuleList()); + $module_list = array_combine($modules, $modules); $cid = drush_cid_install_profile(); if ($cached = drush_cache_get($cid)) { $ignored_modules[] = $cached->data; } - foreach (array_diff(drush_module_list(), $ignored_modules) as $module) { + foreach (array_diff($module_list, $ignored_modules) as $module) { $searchpaths[] = drupal_get_path('module', $module); } @@ -102,7 +104,6 @@ public function requirements($options = ['format' => 'table', 'severity' => -1, drupal_load_updates(); - drush_include_engine('drupal', 'environment'); $requirements = \Drupal::moduleHandler()->invokeAll('requirements', ['runtime']); // If a module uses "$requirements[] = " instead of // "$requirements['label'] = ", then build a label from diff --git a/src/Commands/core/WatchdogCommands.php b/src/Commands/core/WatchdogCommands.php index 87c4ce08d9..fc6bf306c4 100644 --- a/src/Commands/core/WatchdogCommands.php +++ b/src/Commands/core/WatchdogCommands.php @@ -99,7 +99,6 @@ function watchdogList($substring = '', $options = ['format' => 'table', 'count' * @hook interact watchdog-list */ public function interactList($input, $output) { - drush_include_engine('drupal', 'environment'); $choices['-- types --'] = dt('== message types =='); $types = $this->messageTypes();