Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont use DRUPAL_ROOT in cache:rebuild #5147

Merged
merged 1 commit into from May 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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