diff --git a/src/Handler.php b/src/Handler.php index cfb5fd9..d09f7b4 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -143,7 +143,6 @@ public function onPostCmdEvent(Event $event) { * Downloads drupal scaffold files for the current process. */ public function downloadScaffold() { - $drupalCorePackage = $this->getDrupalCorePackage(); $webroot = realpath($this->getWebRoot()); // Collect options, excludes and settings files. @@ -155,7 +154,22 @@ public function downloadScaffold() { $dispatcher = new EventDispatcher($this->composer, $this->io); $dispatcher->dispatch(self::PRE_DRUPAL_SCAFFOLD_CMD); - $version = $this->getDrupalCoreVersion($drupalCorePackage); + // First check for inline aliases. This allows a fork of drupal/core to be + // used, so that a require constraint of "8.6.1-patch1 as 8.6.1" will + // download the correct scaffolding files. + $aliases = $this->composer->getPackage()->getAliases(); + $version = NULL; + foreach ($aliases as $alias) { + if ($alias['package'] == 'drupal/core') { + $version = $alias['alias']; + } + } + + // No alias was found, so use the version from the package. + if (!$version) { + $drupalCorePackage = $this->getDrupalCorePackage(); + $version = $this->getDrupalCoreVersion($drupalCorePackage); + } $remoteFs = new RemoteFilesystem($this->io);