Skip to content

Commit

Permalink
Fix path to files directory when it is a symlink (#6047) (#6048)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
greg-1-anderson authored Jun 22, 2024
1 parent d2f2c67 commit 7a3eebb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Commands/core/ArchiveDumpCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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), '/'),
Expand Down Expand Up @@ -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.'));
}
Expand Down

0 comments on commit 7a3eebb

Please sign in to comment.