Skip to content

Commit 0b4b40a

Browse files
author
Teppo Koivula
committed
Fix an issue where 'site-' prefix was unnecessarily added to module directories
1 parent 2862afa commit 0b4b40a

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.0.4] - 2019-06-10
11+
12+
### Fixed
13+
- Fix an issue where 'site-' prefix was unnecessarily added to module directories.
14+
1015
## [0.0.3] - 2019-06-07
1116

1217
### Added

src/ComposerInstaller/BaseInstaller.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ protected function getName(PackageInterface $package) {
8282
$name = $extra['installer-name'];
8383
}
8484

85-
// make sure that the directory name has a site- prefix; if not, add
86-
if (strpos($name, 'site-') !== 0) {
87-
$name = 'site-' . $name;
88-
}
89-
9085
return $name;
9186
}
9287

src/ComposerInstaller/SiteProfileInstaller.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,27 @@ public function getInstallPath(PackageInterface $package)
6060
return $this->getFullPath($package, static::BASE_PATH);
6161
}
6262

63+
/**
64+
* Get the directory name from package name
65+
*
66+
* Default directory name can be overridden by specifying extra argument
67+
* "installer-name" in the composer.json of the package in question.
68+
*
69+
* @param PackageInterface $package
70+
* @return string Module or site profile name.
71+
*/
72+
protected function getName(PackageInterface $package) {
73+
// fetch initial directory name
74+
$name = parent::getName($package);
75+
76+
// make sure that the directory name has a site- prefix; if not, add
77+
if (strpos($name, 'site-') !== 0) {
78+
$name = 'site-' . $name;
79+
}
80+
81+
return $name;
82+
}
83+
6384
/**
6485
* Get nested site directory path, or null if none found
6586
*

0 commit comments

Comments
 (0)