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

Canonicalize all paths in status output. #5049

Merged
merged 2 commits into from Mar 6, 2022
Merged
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
17 changes: 9 additions & 8 deletions src/Commands/core/StatusCommands.php
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