From 8389f62c17dee1e9212c97e69410e126989f211a Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Sat, 22 Jun 2024 10:22:18 -0700 Subject: [PATCH] Fix path to files directory when it is a symlink (#6047) * 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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Commands/core/ArchiveDumpCommands.php b/src/Commands/core/ArchiveDumpCommands.php index 1567cb67e5..7f9cc2613b 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; @@ -381,6 +382,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), '/'), @@ -451,8 +456,7 @@ private function getDrupalFilesComponentPath(): string } /** - * Returns the path to Drupal files directory. - * + * Returns the full path to Drupal files directory. * * @throws \Exception */ @@ -463,7 +467,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.')); }