Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"consolidation/config": "^1.1.0",
"consolidation/output-formatters": "^3.1.12",
"consolidation/robo": "^1.1.5",
"consolidation/site-alias": "^1.1.1",
"consolidation/site-alias": "^1.1.2",
"grasmash/yaml-expander": "^1.1.1",
"league/container": "~2",
"psr/log": "~1.0",
Expand Down
2 changes: 1 addition & 1 deletion scenarios/isolation-phpunit4/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"php": ">=5.6.0",
"ext-dom": "*",
"consolidation/config": "^1.1.0",
"consolidation/site-alias": "^1.1.1",
"consolidation/site-alias": "^1.1.2",
"psr/log": "~1.0",
"sebastian/version": "^1|^2",
"symfony/finder": "~2.7|^3",
Expand Down
2 changes: 1 addition & 1 deletion scenarios/isolation/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"php": ">=5.6.0",
"ext-dom": "*",
"consolidation/config": "^1.1.0",
"consolidation/site-alias": "^1.1.1",
"consolidation/site-alias": "^1.1.2",
"psr/log": "~1.0",
"sebastian/version": "^1|^2",
"symfony/finder": "~2.7|^3",
Expand Down
22 changes: 19 additions & 3 deletions src/Commands/core/SiteCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ public function siteSet($site = '@none')
*/
public function siteAlias($site = null, $options = ['format' => 'yaml'])
{
// Check to see if the user provided a specification that matches
// First check to see if the user provided a specification that matches
// multiple sites.
$aliasList = $this->siteAliasManager()->getMultiple($site);
if (is_array($aliasList)) {
list($locationPart, $sitePart) = $this->splitLocationFromSite($site);
$aliasList = $this->siteAliasManager()->getMultiple($sitePart, $locationPart);
if (is_array($aliasList) && !empty($aliasList)) {
return new ListDataFromKeys($this->siteAliasExportList($aliasList, $options));
}

Expand All @@ -135,6 +136,21 @@ public function siteAlias($site = null, $options = ['format' => 'yaml'])
}
}

/**
* splitLocationFromSite returns the location and the site if the
* site alias is in the form '@location.site'. Otherwise it just
* returns the site unchanged, without a location.
*/
protected function splitLocationFromSite($site)
{
$parts = explode('.', ltrim($site, '@'));

if (count($parts) == 2) {
return [$parts[0], '@' . $parts[1]];
}
return [null, $site];
}

/**
* Convert legacy site alias files to the new yml format.
*
Expand Down