Skip to content

Commit

Permalink
Canonicalize all paths in status output. (#5049)
Browse files Browse the repository at this point in the history
* Canonicalize all paths in status output.

* Filter null paths
  • Loading branch information
weitzman authored Mar 6, 2022
1 parent c4817be commit 0a78313
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Commands/core/StatusCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Consolidation\SiteAlias\SiteAliasManagerAwareTrait;
use Consolidation\OutputFormatters\Options\FormatterOptions;
use Consolidation\AnnotatedCommand\CommandData;
use Webmozart\PathUtil\Path;

class StatusCommands extends DrushCommands implements SiteAliasManagerAwareInterface
{
Expand Down Expand Up @@ -92,7 +93,7 @@ public function getPropertyList($options): array
if (($drupal_root = $boot_manager->getRoot()) && ($boot_object instanceof DrupalBoot)) {
$status_table['drupal-version'] = $boot_object->getVersion($drupal_root);
$conf_dir = $boot_object->confPath();
$settings_file = "$conf_dir/settings.php";
$settings_file = Path::join($conf_dir, 'settings.php');
$status_table['drupal-settings-file'] = file_exists($settings_file) ? $settings_file : '';
if ($boot_manager->hasBootstrapped(DRUSH_BOOTSTRAP_DRUPAL_SITE)) {
$status_table['uri'] = $boot_manager->getUri();
Expand Down Expand Up @@ -130,21 +131,21 @@ public function getPropertyList($options): array
$status_table['admin-theme'] = $theme = \Drupal::config('system.theme')->get('admin') ?: 'seven';
}
}
$status_table['php-bin'] = PHP_BINARY;
$status_table['php-bin'] = Path::canonicalize(PHP_BINARY);
$status_table['php-os'] = PHP_OS;
if ($phpIniFiles = EditCommands::phpIniFiles()) {
$status_table['php-conf'] = $phpIniFiles;
$status_table['php-conf'] = array_map('Webmozart\PathUtil\Path::canonicalize', $phpIniFiles);
}
$status_table['drush-script'] = $this->getConfig()->get('runtime.drush-script');
$status_table['drush-script'] = Path::canonicalize($this->getConfig()->get('runtime.drush-script'));
$status_table['drush-version'] = Drush::getVersion();
$status_table['drush-temp'] = $this->getConfig()->tmp();
$status_table['drush-conf'] = $this->getConfig()->configPaths();
$status_table['drush-temp'] = Path::canonicalize($this->getConfig()->tmp());
$status_table['drush-conf'] = array_map('Webmozart\PathUtil\Path::canonicalize', $this->getConfig()->configPaths());
// List available alias files
$alias_files = $this->siteAliasManager()->listAllFilePaths();
sort($alias_files);
$status_table['drush-alias-files'] = $alias_files;
$alias_searchpaths = $this->siteAliasManager()->searchLocations();
$status_table['alias-searchpaths'] = $alias_searchpaths;
$status_table['alias-searchpaths'] = array_map('Webmozart\PathUtil\Path::canonicalize', $alias_searchpaths);

$paths = self::pathAliases($options, $boot_manager, $boot_object);
if (!empty($paths)) {
Expand All @@ -160,7 +161,7 @@ public function getPropertyList($options): array
// Store the paths into the '%paths' index; this will be
// used by other code, but will not be included in the default output
// of the drush status command.
$status_table['%paths'] = $paths;
$status_table['%paths'] = array_map('Webmozart\PathUtil\Path::canonicalize', array_filter($paths));

return $status_table;
}
Expand Down

0 comments on commit 0a78313

Please sign in to comment.