Skip to content

Commit

Permalink
Removing additional "0" site in the array returned from `Dotenv::getS…
Browse files Browse the repository at this point in the history
…ites`. Updating change log.
  • Loading branch information
dl-unleashed-technologies committed Jan 27, 2022
1 parent fa33463 commit 7d271ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi

## [Unreleased][unreleased]

## [0.1.17] - 2022-01-27

### Fixed

- Removed additional "0" site in the array returned from `Dotenv::getSites`.

## [0.1.16] - 2022-01-26

### Fixed
Expand Down Expand Up @@ -120,7 +126,8 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi

**Initial release!**

[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.16...main
[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.17...main
[0.1.17]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.16...0.1.17
[0.1.16]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.15...0.1.16
[0.1.15]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.14...0.1.15
[0.1.14]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.13...0.1.14
Expand Down
10 changes: 6 additions & 4 deletions src/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,15 @@ public function getSettings(): array
*/
public function getSites(): array
{
$domains = explode(',', $_SERVER['DOMAINS'] ?? 'default.example');
$sites = explode(',', $_SERVER['SITES'] ?? 'default');
foreach ($sites as $site) {
$domains = \explode(',', $_SERVER['DOMAINS'] ?? 'default.example');
$siteNames = \explode(',', $_SERVER['SITES'] ?? 'default');
$sites = [];
foreach ($siteNames as $siteName) {
foreach ($domains as $domain) {
$sites[$site . '.' . $domain] = $site;
$sites[$siteName . '.' . $domain] = $siteName;
}
}

return $sites;
}

Expand Down

0 comments on commit 7d271ee

Please sign in to comment.