Loading core/assets/scaffold/files/default.settings.php +4 −4 Changes for core/assets/scaffold/files/default.settings.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -778,11 +778,11 @@ # $settings['trusted_host_patterns'] = []; /** * The default list of directories that will be ignored by Drupal's file API. * Directories that will be ignored by Drupal's file API and when scanning for * extensions and hooks. * * By default ignore node_modules and bower_components folders to avoid issues * with common frontend tools and recursive scanning of directories looking for * extensions. * By default, node_modules and bower_components are ignored to speed up scanning * by skipping folders containing non-PHP build dependencies. * * @see \Drupal\Core\File\FileSystemInterface::scanDirectory() * @see \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory() Loading core/lib/Drupal/Core/Hook/HookCollectorPass.php +3 −1 Changes for core/lib/Drupal/Core/Hook/HookCollectorPass.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use Drupal\Core\Hook\Attribute\RemoveHook; use Drupal\Core\Hook\Attribute\ReorderHook; use Drupal\Core\Hook\OrderOperation\OrderOperation; use Drupal\Core\Site\Settings; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; Loading Loading @@ -532,8 +533,9 @@ protected static function filterIterator(\SplFileInfo $fileInfo, $key, \Recursiv if ($sub_path_name === 'src' || $sub_path_name === 'src/Hook') { return TRUE; } $ignore_directories = Settings::get('file_scan_ignore_directories', []); // glob() doesn't support streams but scandir() does. return !in_array($fileInfo->getFilename(), ['tests', 'js', 'css']) && !array_filter(scandir($key), static fn ($filename) => str_ends_with($filename, '.info.yml')); return !in_array($fileInfo->getFilename(), array_merge(['tests', 'js', 'css'], $ignore_directories)) && !array_filter(scandir($key), static fn ($filename) => str_ends_with($filename, '.info.yml')); } return in_array($extension, ['inc', 'module', 'profile', 'install']); } Loading core/lib/Drupal/Core/Hook/ThemeHookCollectorPass.php +3 −1 Changes for core/lib/Drupal/Core/Hook/ThemeHookCollectorPass.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Drupal\Core\Hook\Attribute\RemoveHook; use Drupal\Core\Hook\Attribute\ProceduralHookScanStop; use Drupal\Core\Hook\Attribute\ReorderHook; use Drupal\Core\Site\Settings; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; Loading Loading @@ -357,8 +358,9 @@ protected static function filterIterator(\SplFileInfo $fileInfo, $key, \Recursiv if ($subPathName === 'src' || $subPathName === 'src/Hook') { return TRUE; } $ignore_directories = Settings::get('file_scan_ignore_directories', []); // glob() doesn't support streams but scandir() does. return !in_array($fileInfo->getFilename(), ['tests', 'js', 'css', 'templates']) && !array_filter(scandir($key), static fn($filename) => str_ends_with($filename, '.info.yml')); return !in_array($fileInfo->getFilename(), array_merge(['tests', 'js', 'css', 'templates'], $ignore_directories)) && !array_filter(scandir($key), static fn($filename) => str_ends_with($filename, '.info.yml')); } if ($fileInfo->getFilename() === 'theme-settings.php') { return TRUE; Loading core/modules/system/tests/modules/HookCollector/ignored_directories_hook_collector_test/ignored_directories_hook_collector_test.info.yml 0 → 100644 +5 −0 Changes for core/modules/system/tests/modules/HookCollector/ignored_directories_hook_collector_test/ignored_directories_hook_collector_test.info.yml: 5 added lines, 0 removed lines. Original line number Diff line number Diff line name: Test module used to test ignored directories in hook collector type: module description: 'Test module used to test ignored directories in hook collector.' package: Testing version: VERSION core/modules/system/tests/modules/HookCollector/ignored_directories_hook_collector_test/ignored_directory/procedural_hooks.inc 0 → 100644 +16 −0 Changes for core/modules/system/tests/modules/HookCollector/ignored_directories_hook_collector_test/ignored_directory/procedural_hooks.inc: 16 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @file * Test hooks to check directory ignore when scanning. * * @todo Remove this module when procedural hooks in modules are no * longer supported https://www.drupal.org/project/drupal/issues/3481555 */ declare(strict_types=1); /** * Implements hook_ignored_alter(). */ function ignored_directories_hook_collector_test_ignored_alter(): void {} Loading
core/assets/scaffold/files/default.settings.php +4 −4 Changes for core/assets/scaffold/files/default.settings.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -778,11 +778,11 @@ # $settings['trusted_host_patterns'] = []; /** * The default list of directories that will be ignored by Drupal's file API. * Directories that will be ignored by Drupal's file API and when scanning for * extensions and hooks. * * By default ignore node_modules and bower_components folders to avoid issues * with common frontend tools and recursive scanning of directories looking for * extensions. * By default, node_modules and bower_components are ignored to speed up scanning * by skipping folders containing non-PHP build dependencies. * * @see \Drupal\Core\File\FileSystemInterface::scanDirectory() * @see \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory() Loading
core/lib/Drupal/Core/Hook/HookCollectorPass.php +3 −1 Changes for core/lib/Drupal/Core/Hook/HookCollectorPass.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ use Drupal\Core\Hook\Attribute\RemoveHook; use Drupal\Core\Hook\Attribute\ReorderHook; use Drupal\Core\Hook\OrderOperation\OrderOperation; use Drupal\Core\Site\Settings; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; Loading Loading @@ -532,8 +533,9 @@ protected static function filterIterator(\SplFileInfo $fileInfo, $key, \Recursiv if ($sub_path_name === 'src' || $sub_path_name === 'src/Hook') { return TRUE; } $ignore_directories = Settings::get('file_scan_ignore_directories', []); // glob() doesn't support streams but scandir() does. return !in_array($fileInfo->getFilename(), ['tests', 'js', 'css']) && !array_filter(scandir($key), static fn ($filename) => str_ends_with($filename, '.info.yml')); return !in_array($fileInfo->getFilename(), array_merge(['tests', 'js', 'css'], $ignore_directories)) && !array_filter(scandir($key), static fn ($filename) => str_ends_with($filename, '.info.yml')); } return in_array($extension, ['inc', 'module', 'profile', 'install']); } Loading
core/lib/Drupal/Core/Hook/ThemeHookCollectorPass.php +3 −1 Changes for core/lib/Drupal/Core/Hook/ThemeHookCollectorPass.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Drupal\Core\Hook\Attribute\RemoveHook; use Drupal\Core\Hook\Attribute\ProceduralHookScanStop; use Drupal\Core\Hook\Attribute\ReorderHook; use Drupal\Core\Site\Settings; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; Loading Loading @@ -357,8 +358,9 @@ protected static function filterIterator(\SplFileInfo $fileInfo, $key, \Recursiv if ($subPathName === 'src' || $subPathName === 'src/Hook') { return TRUE; } $ignore_directories = Settings::get('file_scan_ignore_directories', []); // glob() doesn't support streams but scandir() does. return !in_array($fileInfo->getFilename(), ['tests', 'js', 'css', 'templates']) && !array_filter(scandir($key), static fn($filename) => str_ends_with($filename, '.info.yml')); return !in_array($fileInfo->getFilename(), array_merge(['tests', 'js', 'css', 'templates'], $ignore_directories)) && !array_filter(scandir($key), static fn($filename) => str_ends_with($filename, '.info.yml')); } if ($fileInfo->getFilename() === 'theme-settings.php') { return TRUE; Loading
core/modules/system/tests/modules/HookCollector/ignored_directories_hook_collector_test/ignored_directories_hook_collector_test.info.yml 0 → 100644 +5 −0 Changes for core/modules/system/tests/modules/HookCollector/ignored_directories_hook_collector_test/ignored_directories_hook_collector_test.info.yml: 5 added lines, 0 removed lines. Original line number Diff line number Diff line name: Test module used to test ignored directories in hook collector type: module description: 'Test module used to test ignored directories in hook collector.' package: Testing version: VERSION
core/modules/system/tests/modules/HookCollector/ignored_directories_hook_collector_test/ignored_directory/procedural_hooks.inc 0 → 100644 +16 −0 Changes for core/modules/system/tests/modules/HookCollector/ignored_directories_hook_collector_test/ignored_directory/procedural_hooks.inc: 16 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @file * Test hooks to check directory ignore when scanning. * * @todo Remove this module when procedural hooks in modules are no * longer supported https://www.drupal.org/project/drupal/issues/3481555 */ declare(strict_types=1); /** * Implements hook_ignored_alter(). */ function ignored_directories_hook_collector_test_ignored_alter(): void {}