Skip to content

Commit

Permalink
Dont use DRUPAL_ROOT in cache:rebuild (#5147)
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed May 17, 2022
1 parent d6d0551 commit 28e27db
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Commands/core/CacheCommands.php
Expand Up @@ -212,19 +212,16 @@ public function rebuild($options = ['cache-clear' => true])
$this->logger()->info(dt("Skipping cache-clear operation due to --no-cache-clear option."));
return true;
}
chdir(DRUPAL_ROOT);

// We no longer clear APC and similar caches as they are useless on CLI.
// See https://github.com/drush-ops/drush/pull/2450

$autoloader = $this->loadDrupalAutoloader(DRUPAL_ROOT);
$root = Drush::bootstrapManager()->getRoot();
$autoloader = $this->loadDrupalAutoloader($root);
require_once DRUSH_DRUPAL_CORE . '/includes/utility.inc';

$request = Drush::bootstrap()->getRequest();
DrupalKernel::bootEnvironment();

// Avoid 'Only variables should be passed by reference'
$root = DRUPAL_ROOT;
$site_path = DrupalKernel::findSitePath($request);
Settings::initialize($root, $site_path, $autoloader);

Expand Down

0 comments on commit 28e27db

Please sign in to comment.