Skip to content

Commit

Permalink
Remove environment engine (#2657)
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman authored Mar 10, 2017
1 parent 2d98048 commit 3cd3e7d
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 96 deletions.
19 changes: 0 additions & 19 deletions commands/core/core.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
44 changes: 0 additions & 44 deletions commands/core/drupal/environment.inc

This file was deleted.

1 change: 0 additions & 1 deletion includes/batch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 3 additions & 2 deletions src/Boot/DrupalBoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down
11 changes: 2 additions & 9 deletions src/Boot/DrupalBoot6.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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(
Expand Down
15 changes: 1 addition & 14 deletions src/Boot/DrupalBoot7.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 0 additions & 4 deletions src/Commands/core/CacheCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions src/Commands/core/CoreCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/Commands/core/WatchdogCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3cd3e7d

Please sign in to comment.