diff --git a/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php b/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php index be2051a..e8d757d 100644 --- a/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php +++ b/core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php @@ -15,18 +15,20 @@ class RecursiveExtensionFilterIterator extends \RecursiveFilterIterator { 'lib', 'vendor', // Front-end. - 'templates', 'assets', - 'js', 'css', - 'misc', 'files', - // Root subdirectories. + 'images', + 'js', + 'misc', + 'templates', + // Legacy subdirectories. 'includes', 'scripts', - // @todo Skip ./config directories (but not modules/config). - //'config', - //'schema', + // Test subdirectories. + 'fixtures', + // @todo ./tests/Drupal should be ./tests/src/Drupal + 'Drupal', ); protected $acceptTests = FALSE; @@ -47,18 +49,28 @@ public function getChildren() { } public function accept() { - // Should normally never be TRUE, since ExtensionDiscovery passes the - // FilesystemIterator::SKIP_DOTS flag to RecursiveDirectoryIterator, but - // in case this filter is instantiated from elsewhere, ensure that we are - // not recursing into parent directories. - if ($this->isDot()) { + $name = $this->current()->getFilename(); + // The FilesystemIterator::SKIP_DOTS flag only skips '.' and '..', but not + // hidden directories (like '.git'). + if ($name[0] == '.') { return FALSE; } if ($this->isDir()) { - return !in_array($this->current()->getFilename(), $this->skipDirs, TRUE); + // 'config' directories are special-cased here, because every extension + // contains one. However, those default configuration directories cannot + // contain extensions. The directory name cannot be globally skipped, + // because core happens to have a directory of an actual module that is + // named 'config'. By explicitly testing for that case, we can skip all + // other config directories, and at the same time, still allow the core + // config module to be overridden/replaced in a profile/site directory + // (whereas it must be located directly in a modules directory). + if ($name == 'config') { + return substr($this->current()->getPathname(), -14) == 'modules/config'; + } + return !in_array($name, $this->skipDirs, TRUE); } else { - return substr($this->current()->getFilename(), -9) == '.info.yml'; + return substr($name, -9) == '.info.yml'; } } diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php index bb859b2..32f4fe9 100644 --- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php +++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php @@ -87,10 +87,9 @@ public function scan($directory, $include_tests = FALSE) { $type = substr($directory, 0, -1); } - $site = conf_path(); - // Installation profile directories can only be scanned for extensions when // not scanning for installation profiles themselves. + // @todo Obsolete? $profileDirectories = array(); if ($directory != 'profiles') { // Determine the installation profile directories to scan for extensions, @@ -103,19 +102,18 @@ public function scan($directory, $include_tests = FALSE) { } } - // Search for the directory in core. $searchdirs = array(); - $searchdirs[] = 'core/' . $directory; + $searchdirs[] = 'core'; + // Search installation profile directories. foreach ($profileDirectories as $profile) { - $searchdirs[] = $profile . '/' . $directory; + $searchdirs[] = $profile; } - // Always search for contributed and custom extensions in top-level - // directories as well as sites/all/* directories. If the same extension is - // located in both directories, then the latter wins for legacy/historical - // reasons. + // Search for contributed and custom extensions in top-level directories + // (and the sites/all directory for legacy/BC reasons) as well as the + // site-specific directory. $searchdirs[] = $directory; - $searchdirs[] = 'sites/all/' . $directory; - $searchdirs[] = "$site/$directory"; + $searchdirs[] = 'sites/all'; + $searchdirs[] = conf_path(); // Unless explicitly requested by Simpletest, manually check whether we are // are in a test environment, in which case test extensions must be included. diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index d486973..0e2424c 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -599,10 +599,6 @@ public function install(array $module_list, $enable_dependencies = TRUE) { $this->load($module); module_load_install($module); - // Flush theme info caches, since (testing) modules can implement - // hook_system_theme_info() to register additional themes. - system_list_reset(); - // Update the kernel to include it. // This reboots the kernel to register the module's bundle and its // services in the service container. The $module_filenames argument is diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index 5e1c2da..bbae941 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -243,21 +243,8 @@ public function reset() { * {@inheritdoc} */ public function rebuildThemeData() { - // Find themes. $listing = $this->getSystemListing(); $themes = $listing->scan('themes'); - // Allow modules to add further themes. - if ($module_themes = $this->moduleHandler->invokeAll('system_theme_info')) { - foreach ($module_themes as $name => $uri) { - // @see \Drupal\Core\Extension\ExtensionDiscovery - $themes[$name] = $theme = new \SplFileInfo($uri); - $theme->uri = $uri; - $theme->filename = $theme->getFilename(); - $theme->name = $name; - } - } - - // Find theme engines. $engines = $listing->scan('themes/engines'); // Set defaults for theme info. diff --git a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php index 65f26a0..ad30760 100644 --- a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php @@ -46,8 +46,6 @@ public function getImplementations($hook) { case 'stream_wrappers': return array('system'); - // This is called during rebuild to find testing themes. - case 'system_theme_info': // Those are needed by user_access() to check access on update.php. case 'entity_info': case 'entity_load': diff --git a/core/modules/block/tests/modules/block_test/block_test.module b/core/modules/block/tests/modules/block_test/block_test.module index 4370202..1530f2c 100644 --- a/core/modules/block/tests/modules/block_test/block_test.module +++ b/core/modules/block/tests/modules/block_test/block_test.module @@ -6,14 +6,6 @@ */ /** - * Implements hook_system_theme_info(). - */ -function block_test_system_theme_info() { - $themes['block_test_theme'] = drupal_get_path('module', 'block_test') . '/themes/block_test_theme/block_test_theme.info.yml'; - return $themes; -} - -/** * Implements hook_block_alter(). */ function block_test_block_alter(&$block_info) { diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php index ed88881..153df41 100644 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php @@ -15,13 +15,6 @@ */ class BreakpointThemeTest extends BreakpointGroupTestBase { - /** - * Modules to enable. - * - * @var array - */ - public static $modules = array('breakpoint_theme_test'); - public static function getInfo() { return array( 'name' => 'Breakpoint theme functionality', diff --git a/core/modules/breakpoint/tests/breakpoint_theme_test.info.yml b/core/modules/breakpoint/tests/breakpoint_theme_test.info.yml deleted file mode 100644 index f035360..0000000 --- a/core/modules/breakpoint/tests/breakpoint_theme_test.info.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: 'Breakpoint theme test' -type: module -description: 'Test breakpoints provided by themes' -package: Other -version: VERSION -core: 8.x -hidden: true -dependencies: - - breakpoint diff --git a/core/modules/breakpoint/tests/breakpoint_theme_test.module b/core/modules/breakpoint/tests/breakpoint_theme_test.module deleted file mode 100644 index 765cc50..0000000 --- a/core/modules/breakpoint/tests/breakpoint_theme_test.module +++ /dev/null @@ -1,13 +0,0 @@ -will($this->returnValue(array())); // Ensure that the themes_enabled hook is fired. - $this->moduleHandler->expects($this->at(0)) - ->method('invokeAll') - ->with('system_theme_info') - ->will($this->returnValue(array())); - $this->moduleHandler->expects($this->at(1)) ->method('invokeAll') ->with('themes_enabled', array($theme_list));