Skip to content
Snippets Groups Projects

Resolve #3408488 "Make unknownpathexcluder accept"

Compare and Show latest version
2 files
+ 21
18
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -25,11 +25,11 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
* If web root and project root are the same, nothing is excluded.
*
* This excluder can be disabled by changing the config setting
* `package_manager.settings:include_unknown_files` to TRUE. This may be needed
* for sites that have files outside the web root (besides the vendor directory)
* which are nonetheless needed in order for Composer to assemble the code base
* correctly; a classic example would be a directory of patch files used by
* `cweagans/composer-patches`.
* `package_manager.settings:include_unknown_files_in_project_root` to TRUE.
* This may be needed for sites that have files outside the web root (besides
* the vendor directory) which are nonetheless needed in order for Composer to
* assemble the code base correctly; a classic example would be a directory of
* patch files used by `cweagans/composer-patches`.
*
* @internal
* This is an internal part of Package Manager and may be changed or removed
@@ -73,13 +73,12 @@ final class UnknownPathExcluder implements EventSubscriberInterface {
* See \Drupal\package_manager\ComposerInspector::validate().
*/
public function excludeUnknownPaths(CollectPathsToExcludeEvent $event): void {
if ($this->configFactory->get('package_manager.settings')->get('include_unknown_files_in_project_root')) {
return;
}
// If the project root and web root are the same, there's nothing to do.
// If this excluder is disabled, or the project root and web root are the
// same, there's nothing to do.
$is_disabled = $this->configFactory->get('package_manager.settings')
->get('include_unknown_files_in_project_root');
$web_root = $this->pathLocator->getWebRoot();
if (empty($web_root)) {
if ($is_disabled || empty($web_root)) {
return;
}
@@ -144,8 +143,8 @@ final class UnknownPathExcluder implements EventSubscriberInterface {
$packages = $this->composerInspector->getInstalledPackagesList($project_root);
$extra = Json::decode($this->composerInspector->getConfig('extra', $packages['drupal/core']->path . '/composer.json'));
$scaffold_files = array_keys($extra['drupal-scaffold']['file-mapping'] ?? []);
return str_replace('[project-root]', '', $scaffold_files);
$scaffold_files = $extra['drupal-scaffold']['file-mapping'] ?? [];
return str_replace('[project-root]', '', array_keys($scaffold_files));
}
}
Loading