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

Fixed use of DRUPAL_ROOT in cache:rebuild command. #4713

Closed
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
9 changes: 7 additions & 2 deletions src/Commands/core/CacheCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,13 @@ 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);

// Through some magic I don't claim to understand, the current directory
// is already the web root.
// Use this, and NOT the DRUPAL_ROOT constant, as that is unreliable if
// the Drupal package is not installed in the usual location and
// symlinked in by Composer.
$root = getcwd();

// We no longer clear APC and similar caches as they are useless on CLI.
// See https://github.com/drush-ops/drush/pull/2450
Expand All @@ -226,7 +232,6 @@ public function rebuild($options = ['cache-clear' => true])
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