From 7a3eebbac366bbe8132ccd809490f7490e92b0cb Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Sat, 22 Jun 2024 10:42:21 -0700 Subject: [PATCH] Fix path to files directory when it is a symlink (#6047) (#6048) * Fix path to files directory when it is a symlink * Convert back to full path prior to calling realpath() * Fix path logic * Remove unused function * Remove path repositories from consideration * We don't actually need the relative path --- src/Commands/core/ArchiveDumpCommands.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Commands/core/ArchiveDumpCommands.php b/src/Commands/core/ArchiveDumpCommands.php index eed14b444c..e6138750c7 100644 --- a/src/Commands/core/ArchiveDumpCommands.php +++ b/src/Commands/core/ArchiveDumpCommands.php @@ -5,6 +5,7 @@ namespace Drush\Commands\core; use Drupal; +use Drupal\Core\StreamWrapper\PublicStream; use Drush\Attributes as CLI; use Drush\Boot\DrupalBootLevels; use Drush\Commands\DrushCommands; @@ -384,6 +385,10 @@ private function getCodeComponentPath(array $options): string $process->mustRun(); $composerInfoRaw = $process->getOutput(); $installedPackages = json_decode($composerInfoRaw, true)['installed'] ?? []; + // Remove path projects ('source' is empty for path projects) + $installedPackages = array_filter($installedPackages, function ($dependency) { + return !empty($dependency['source']); + }); $installedPackagesPaths = array_filter(array_column($installedPackages, 'path')); $installedPackagesRelativePaths = array_map( fn($path) => ltrim(str_replace([$this->getComposerRoot()], '', $path), '/'), @@ -467,7 +472,7 @@ private function getDrupalFilesDir(): string } Drush::bootstrapManager()->doBootstrap(DrupalBootLevels::FULL); - $drupalFilesPath = Drupal::service('file_system')->realpath('public://'); + $drupalFilesPath = Path::join($this->getRoot(), PublicStream::basePath()); if (!$drupalFilesPath) { throw new Exception(dt('Path to Drupal files is empty.')); }