diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 7634354..a46b7bf 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -10,7 +10,7 @@ use Drupal\Core\DrupalKernel; use Drupal\Core\Database\Database; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; use Drupal\Core\Utility\Title; use Drupal\Core\Utility\Error; use Symfony\Component\ClassLoader\ApcClassLoader; @@ -754,7 +754,7 @@ function drupal_get_filename($type, $name, $filename = NULL) { // extension, not just the file we are currently looking for. This // prevents unnecessary scans from being repeated when this function is // called more than once in the same page request. - $listing = new SystemListingInfo(); + $listing = new SystemListing(); $matches = $listing->scan("/^" . DRUPAL_PHP_FUNCTION_PATTERN . "\.$extension$/", $dir); foreach ($matches as $matched_name => $file) { $files[$type][$matched_name] = $file->uri; diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 5a4b1eb..8519961 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -13,7 +13,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Drupal\Core\StringTranslation\Translator\FileTranslation; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; use Drupal\Core\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Reference; @@ -497,7 +497,7 @@ function install_begin_request(&$install_state) { $module_handler->loadAll(); // Add list of all available profiles to the installation state. - $listing = new SystemListingInfo(); + $listing = new SystemListing(); $install_state['profiles'] += $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles'); // Prime drupal_get_filename()'s static cache. diff --git a/core/includes/install.inc b/core/includes/install.inc index 1465504..dc09906 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -9,7 +9,7 @@ use Drupal\Component\Utility\Crypt; use Drupal\Core\Database\Database; use Drupal\Core\DrupalKernel; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; /** * Requirement severity -- Informational message only. @@ -570,9 +570,8 @@ function drupal_verify_profile($install_state) { } $info = $install_state['profile_info']; - // Get a list of modules that exist in Drupal's assorted subdirectories. - $profile_directories = array(dirname($profile_file)); - $listing = new SystemListingInfo($profile_directories); + // Get the list of available modules for the selected installation profile. + $listing = new SystemListing(); $present_modules = array(); foreach ($listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules') as $present_module) { $present_modules[] = $present_module->name; diff --git a/core/includes/module.inc b/core/includes/module.inc index ebd0cca..e7cad81 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -5,7 +5,7 @@ * API for loading and interacting with Drupal modules. */ -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; /** * Builds a list of bootstrap modules and enabled modules and themes. @@ -286,7 +286,7 @@ function module_uninstall($module_list = array(), $uninstall_dependents = TRUE) * Returns an array of modules required by core. */ function drupal_required_modules() { - $listing = new SystemListingInfo(); + $listing = new SystemListing(); $files = $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules'); $required = array(); diff --git a/core/lib/Drupal/Core/Config/InstallStorage.php b/core/lib/Drupal/Core/Config/InstallStorage.php index b881fe0..2b4f0ad 100644 --- a/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/core/lib/Drupal/Core/Config/InstallStorage.php @@ -7,7 +7,7 @@ namespace Drupal\Core\Config; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; /** * Storage controller used by the Drupal installer. @@ -116,7 +116,7 @@ protected function getAllFolders() { if ($profile = drupal_get_profile()) { $this->folders += $this->getComponentNames('profile', array($profile)); } - $listing = new SystemListingInfo(); + $listing = new SystemListing(); $this->folders += $this->getComponentNames('module', array_keys($listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules'))); $this->folders += $this->getComponentNames('theme', array_keys($listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info\.yml$/', 'themes'))); } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index e6ec3dc..169e86c 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -297,8 +297,8 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ protected function moduleData($module) { if (!$this->moduleData) { // First, find profiles. - $profiles_scanner = new SystemListing(); - $all_profiles = $profiles_scanner->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles'); + $listing = new SystemListing(); + $all_profiles = $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles'); $profiles = array_intersect_key($all_profiles, $this->moduleList); // If a module is within a profile directory but specifies another @@ -314,10 +314,10 @@ protected function moduleData($module) { $profile_directories = array_map(function ($profile) { return dirname($profile->uri); }, $profiles); + $listing->setProfileDirectories($profile_directories); // Now find modules. - $modules_scanner = new SystemListing($profile_directories); - $this->moduleData = $all_profiles + $modules_scanner->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules'); + $this->moduleData = $all_profiles + $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules'); } return isset($this->moduleData[$module]) ? $this->moduleData[$module] : FALSE; } diff --git a/core/lib/Drupal/Core/Extension/InfoParser.php b/core/lib/Drupal/Core/Extension/InfoParser.php index 50723a4..593b34d 100644 --- a/core/lib/Drupal/Core/Extension/InfoParser.php +++ b/core/lib/Drupal/Core/Extension/InfoParser.php @@ -80,7 +80,7 @@ protected function getParser() { * An array of required keys. */ protected function getRequiredKeys() { - return array('core', 'type', 'name'); + return array('type', 'core', 'name'); } } diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index bffa9d5..9722035 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -13,7 +13,7 @@ use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\ConfigInstallerInterface; use Drupal\Core\Routing\RouteBuilder; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; /** * Default theme handler using the config system for enabled/disabled themes. @@ -87,11 +87,11 @@ class ThemeHandler implements ThemeHandlerInterface { protected $routeBuilder; /** - * The system listing info + * A system listing instance. * - * @var \Drupal\Core\SystemListingInfo + * @var \Drupal\Core\SystemListing */ - protected $systemListingInfo; + protected $systemListing; /** * Constructs a new ThemeHandler. @@ -110,17 +110,17 @@ class ThemeHandler implements ThemeHandlerInterface { * database. * @param \Drupal\Core\Routing\RouteBuilder $route_builder * (optional) The route builder to rebuild the routes if a theme is enabled. - * @param \Drupal\Core\SystemListingInfo $system_list_info - * (optional) The system listing info. + * @param \Drupal\Core\SystemListing $system_list + * (optional) A system listing instance. */ - public function __construct(ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, InfoParserInterface $info_parser, ConfigInstallerInterface $config_installer = NULL, RouteBuilder $route_builder = NULL, SystemListingInfo $system_list_info = NULL) { + public function __construct(ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, InfoParserInterface $info_parser, ConfigInstallerInterface $config_installer = NULL, RouteBuilder $route_builder = NULL, SystemListing $system_list = NULL) { $this->configFactory = $config_factory; $this->moduleHandler = $module_handler; $this->cacheBackend = $cache_backend; $this->infoParser = $info_parser; $this->configInstaller = $config_installer; $this->routeBuilder = $route_builder; - $this->systemListingInfo = $system_list_info; + $this->systemListing = $system_list; } /** @@ -244,7 +244,7 @@ public function reset() { */ public function rebuildThemeData() { // Find themes. - $listing = $this->getSystemListingInfo(); + $listing = $this->getSystemListing(); $themes = $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info\.yml$/', 'themes'); // Allow modules to add further themes. if ($module_themes = $this->moduleHandler->invokeAll('system_theme_info')) { @@ -442,16 +442,16 @@ protected function doGetBaseThemes(array $themes, $theme, $used_themes = array() } /** - * Returns a system listing info object. + * Returns a system listing object. * - * @return \Drupal\Core\SystemListingInfo + * @return \Drupal\Core\SystemListing * The system listing object. */ - protected function getSystemListingInfo() { - if (!isset($this->systemListingInfo)) { - $this->systemListingInfo = new SystemListingInfo(); + protected function getSystemListing() { + if (!isset($this->systemListing)) { + $this->systemListing = new SystemListing(); } - return $this->systemListingInfo; + return $this->systemListing; } /** diff --git a/core/lib/Drupal/Core/SystemListing.php b/core/lib/Drupal/Core/SystemListing.php index 3c00e62..a1ea06c 100644 --- a/core/lib/Drupal/Core/SystemListing.php +++ b/core/lib/Drupal/Core/SystemListing.php @@ -2,21 +2,26 @@ /** * @file - * Definition of Drupal\Core\SystemListing. + * Contains \Drupal\Core\SystemListing. */ namespace Drupal\Core; +use Drupal\Core\Extension\InfoParser; + /** - * Returns information about system object files (modules, themes, etc.). - * - * This class requires the list of profiles to be scanned (see - * \Drupal\Core\SystemListing::scan) to be passed into the constructor. Also, - * info files are not parsed. + * Discovers available extensions in the filesystem. */ class SystemListing { /** + * InfoParser instance for parsing .info.yml files. + * + * @var \Drupal\Core\Extension\InfoParser + */ + protected $infoParser; + + /** * Previously discovered files keyed by dynamic directory hash and extension type. * * Dynamic directories are the site directory and the installation profile @@ -34,17 +39,6 @@ class SystemListing { protected $profileDirectories; /** - * Constructs a new listing object. - * - * @param array $profileDirectories - * A list of installation profile directories to search in addition to the - * default directories. - */ - function __construct($profileDirectories = array()) { - $this->profileDirectories = $profileDirectories; - } - - /** * Returns information about system object files (modules, themes, etc.). * * This function is used to find all or some system object files (module @@ -98,16 +92,24 @@ function __construct($profileDirectories = array()) { * - 'filename': File name. * - 'name': Name of file without the extension. */ - function scan($mask, $directory, $key = 'name') { + public function scan($mask, $directory, $key = 'name') { if (!in_array($key, array('uri', 'filename', 'name'))) { $key = 'uri'; } - $config = conf_path(); + $site_directory = conf_path(); + // Installation profile directories can only be scanned for extensions when + // not scanning for installation profiles themselves. $profileDirectories = array(); if ($directory != 'profiles') { - $profileDirectories = $this->getProfileDirectories(); - + // Determine the installation profile directories to scan for extensions, + // unless explicit profile directories have been preset. + if (!isset($this->profileDirectories)) { + $profileDirectories = $this->getProfileDirectories(); + } + else { + $profileDirectories = $this->profileDirectories; + } if (isset($profileDirectories[0]) && $profileDirectories[0] === '') { throw new \RuntimeException('drupal_get_profile() can return an empty string. Please adjust your code.'); } @@ -115,7 +117,7 @@ function scan($mask, $directory, $key = 'name') { // Check static cache. // The static cache is valid unless the dynamic directories have changed. - $dynamic_dirs_hash = implode('|', array($config => $config) + $profileDirectories); + $dynamic_dirs_hash = implode('|', array($site_directory => $site_directory) + $profileDirectories); if (isset(static::$files[$dynamic_dirs_hash][$directory])) { return static::$files[$dynamic_dirs_hash][$directory]; } @@ -133,8 +135,8 @@ function scan($mask, $directory, $key = 'name') { $searchdir[] = $directory; $searchdir[] = 'sites/all/' . $directory; - if (file_exists("$config/$directory")) { - $searchdir[] = "$config/$directory"; + if (file_exists("$site_directory/$directory")) { + $searchdir[] = "$site_directory/$directory"; } // @todo Find a way to skip ./config directories (but not modules/config). $nomask = '/^(CVS|lib|templates|css|js)$/'; @@ -150,13 +152,40 @@ function scan($mask, $directory, $key = 'name') { /** * Returns additional installation profile directories to be scanned. * - * This version only returns those passed to the constructor. - * * @return array - * A list of installation profile directories. + * A list of installation profile directory paths relative to system root. */ protected function getProfileDirectories() { - return $this->profileDirectories; + $searchdir = array(); + $profile = drupal_get_profile(); + // For SimpleTest to be able to test modules packaged together with a + // distribution we need to include the profile of the parent site (in + // which test runs are triggered). + if (drupal_valid_test_ua() && !drupal_installation_attempted()) { + $testing_profile = \Drupal::config('simpletest.settings')->get('parent_profile'); + if ($testing_profile && $testing_profile != $profile) { + $searchdir[] = drupal_get_path('profile', $testing_profile); + } + } + // In case both profile directories contain the same extension, the actual + // profile always has precedence. + if ($profile) { + $searchdir[] = drupal_get_path('profile', $profile); + } + return $searchdir; + } + + /** + * Sets explicit profile directories to scan. + * + * @param array $profileDirectories + * A list of installation profile directories to search for extensions. + * + * @return $this + */ + public function setProfileDirectories(array $paths) { + $this->profileDirectories = $paths; + return $this; } /** @@ -168,10 +197,33 @@ protected function getProfileDirectories() { * The files found in a single directory. * * @return array - * The processed list of file objects. For example, the SystemListingInfo - * class removes files not compatible with the current core version. + * The processed list of file objects. Extensions discovered in later search + * paths and which are not not compatible with the current core version are + * skipped. */ protected function process(array $files, array $files_to_add) { + // Duplicate files found in later search directories take precedence over + // earlier ones, so we want them to overwrite keys in our resulting + // $files array. + // The exception to this is if the later file is from a module or theme not + // compatible with Drupal core. This may occur during upgrades of Drupal + // core when new modules exist in core while older contrib modules with the + // same name exist in a directory such as /modules. + foreach (array_intersect_key($files_to_add, $files) as $file_key => $file) { + // If it has no info file, then we just behave liberally and accept the + // new resource on the list for merging. + if (file_exists($info_file = dirname($file->uri) . '/' . $file->name . '.info.yml')) { + // Get the .info.yml file for the module or theme this file belongs to. + $info = $this->getInfoParser()->parse($info_file); + + // If the module or theme is incompatible with Drupal core, remove it + // from the array for the current search directory, so it is not + // overwritten when merged with the $files array. + if (isset($info['core']) && $info['core'] != \Drupal::CORE_COMPATIBILITY) { + unset($files_to_add[$file_key]); + } + } + } return $files_to_add; } @@ -237,4 +289,17 @@ protected function processFile($file) { $file->name = basename($file->name, '.info'); } + /** + * Returns a parser for parsing .info.yml files. + * + * @return \Drupal\Core\Extension\InfoParser + * The InfoParser instance. + */ + protected function getInfoParser() { + if (!isset($this->infoParser)) { + $this->infoParser = new InfoParser(); + } + return $this->infoParser; + } + } diff --git a/core/lib/Drupal/Core/SystemListingInfo.php b/core/lib/Drupal/Core/SystemListingInfo.php deleted file mode 100644 index a31b7b1..0000000 --- a/core/lib/Drupal/Core/SystemListingInfo.php +++ /dev/null @@ -1,74 +0,0 @@ - - // directories. - $profile = drupal_get_profile(); - // For SimpleTest to be able to test modules packaged together with a - // distribution we need to include the profile of the parent site (in - // which test runs are triggered). - if (drupal_valid_test_ua() && !drupal_installation_attempted()) { - $testing_profile = \Drupal::config('simpletest.settings')->get('parent_profile'); - if ($testing_profile && $testing_profile != $profile) { - $searchdir[] = drupal_get_path('profile', $testing_profile); - } - } - // In case both profile directories contain the same extension, the actual - // profile always has precedence. - if ($profile) { - $searchdir[] = drupal_get_path('profile', $profile); - } - return $searchdir; - } - - /** - * Overrides Drupal\Core\SystemListing::process(). - */ - protected function process(array $files, array $files_to_add) { - // Duplicate files found in later search directories take precedence over - // earlier ones, so we want them to overwrite keys in our resulting - // $files array. - // The exception to this is if the later file is from a module or theme not - // compatible with Drupal core. This may occur during upgrades of Drupal - // core when new modules exist in core while older contrib modules with the - // same name exist in a directory such as /modules. - foreach (array_intersect_key($files_to_add, $files) as $file_key => $file) { - // If it has no info file, then we just behave liberally and accept the - // new resource on the list for merging. - if (file_exists($info_file = dirname($file->uri) . '/' . $file->name . '.info.yml')) { - // Get the .info.yml file for the module or theme this file belongs to. - $info = \Drupal::service('info_parser')->parse($info_file); - - // If the module or theme is incompatible with Drupal core, remove it - // from the array for the current search directory, so it is not - // overwritten when merged with the $files array. - if (isset($info['core']) && $info['core'] != \Drupal::CORE_COMPATIBILITY) { - unset($files_to_add[$file_key]); - } - } - } - return $files_to_add; - } - -} diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/TestInstallStorage.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/TestInstallStorage.php index b4a9672..a4dcda9 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/TestInstallStorage.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/TestInstallStorage.php @@ -8,7 +8,7 @@ namespace Drupal\config_test; use Drupal\Core\Config\InstallStorage; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; /** * Tests configuration of profiles, modules and themes. @@ -23,7 +23,7 @@ class TestInstallStorage extends InstallStorage { */ protected function getAllFolders() { if (!isset($this->folders)) { - $listing = new SystemListingInfo(); + $listing = new SystemListing(); $this->folders = $this->getComponentNames('profile', array_keys($listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles'))); $this->folders += $this->getComponentNames('module', array_keys($listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules'))); $this->folders += $this->getComponentNames('theme', array_keys($listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info\.yml$/', 'themes'))); diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/TestSchemaStorage.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/TestSchemaStorage.php index efe56d7..8c86525 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/TestSchemaStorage.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/TestSchemaStorage.php @@ -8,7 +8,7 @@ namespace Drupal\config_test; use Drupal\Core\Config\Schema\SchemaStorage; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; /** * Tests configuration schemas of profiles, modules and themes. @@ -30,7 +30,7 @@ public function __construct() { */ protected function getAllFolders() { if (!isset($this->folders)) { - $listing = new SystemListingInfo(); + $listing = new SystemListing(); $this->folders = $this->getBaseDataTypeSchema(); $this->folders += $this->getComponentNames('profile', array_keys($listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles'))); $this->folders += $this->getComponentNames('module', array_keys($listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules'))); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index be6d457..1ab4418 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -777,7 +777,7 @@ protected function setUp() { // Set 'parent_profile' of simpletest to add the parent profile's // search path to the child site's search paths. - // @see \Drupal\Core\SystemListingInfo::getProfileDirectories() + // @see \Drupal\Core\SystemListing::getProfileDirectories() \Drupal::config('simpletest.settings')->set('parent_profile', $this->originalProfile)->save(); // Collect modules to install. diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 4670493..2e1eaf1 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -2,7 +2,7 @@ use Drupal\Core\Database\Database; use Drupal\Core\Page\HtmlPage; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; use Drupal\simpletest\TestBase; use Symfony\Component\Process\PhpExecutableFinder; @@ -465,7 +465,7 @@ function simpletest_test_get_all($module = NULL) { $classes = array(); $module_data = system_rebuild_module_data(); $all_data = $module_data + system_rebuild_theme_data(); - $listing = new SystemListingInfo(); + $listing = new SystemListing(); $all_data += $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles'); // If module is set then we keep only that one module. if (isset($module)) { @@ -557,7 +557,7 @@ function simpletest_classloader_register() { ); $classloader = drupal_classloader(); - $listing = new SystemListingInfo(); + $listing = new SystemListing(); foreach ($types as $type => $info) { $matches = $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.' . $info['extension'] . '$/', $info['dir']); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php index 4b2306d..ae9af4e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/SystemListingTest.php @@ -7,7 +7,7 @@ namespace Drupal\system\Tests\Common; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; use Drupal\simpletest\WebTestBase; /** @@ -56,7 +56,7 @@ function testDirectoryPrecedence() { // Now scan the directories and check that the files take precedence as // expected. - $listing = new SystemListingInfo(); + $listing = new SystemListing(); $files = $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules'); foreach ($expected_directories as $module => $directories) { $expected_directory = array_shift($directories); diff --git a/core/modules/system/lib/Drupal/system/Tests/Extension/InfoParserUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Extension/InfoParserUnitTest.php index b0a4207..8be4af9 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Extension/InfoParserUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Extension/InfoParserUnitTest.php @@ -72,7 +72,7 @@ public function testInfoParser() { $this->fail('Expected InfoParserException not thrown when reading missing_keys.info.txt'); } catch (InfoParserException $e) { - $expected_message = "Missing required keys (core, type, name) in $filename."; + $expected_message = "Missing required keys (type, core, name) in $filename."; $this->assertEqual($e->getMessage(), $expected_message); } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 62c2126..d5f7453 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -8,7 +8,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\Cache; use Drupal\Core\Language\Language; -use Drupal\Core\SystemListingInfo; +use Drupal\Core\SystemListing; use Drupal\Core\Utility\ModuleInfo; use Drupal\menu_link\MenuLinkInterface; use Drupal\user\UserInterface; @@ -2580,7 +2580,7 @@ function system_get_module_info($property) { * An associative array of module information. */ function _system_rebuild_module_data() { - $listing = new SystemListingInfo(); + $listing = new SystemListing(); // Find modules $modules = $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules'); diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 7a227bb..e9ab3aa 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -629,7 +629,7 @@ function theme_update_last_check($variables) { * an .info.yml file which claims that the code is compatible with the current * version of Drupal core. * - * @see \Drupal\Core\SystemListingInfo::process() + * @see \Drupal\Core\SystemListing::process() * @see _system_rebuild_module_data() */ function update_verify_update_archive($project, $archive_file, $directory) { diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php index bf49b72..4aeed08 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php @@ -67,9 +67,9 @@ class ThemeHandlerTest extends UnitTestCase { /** * The system listing info. * - * @var \Drupal\Core\SystemListingInfo|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\SystemListing|\PHPUnit_Framework_MockObject_MockObject */ - protected $systemListingInfo; + protected $systemListing; /** * The tested theme handler. @@ -101,10 +101,10 @@ protected function setUp() { $this->routeBuilder = $this->getMockBuilder('Drupal\Core\Routing\RouteBuilder') ->disableOriginalConstructor() ->getMock(); - $this->systemListingInfo = $this->getMockBuilder('Drupal\Core\SystemListingInfo') + $this->systemListing = $this->getMockBuilder('Drupal\Core\SystemListing') ->disableOriginalConstructor() ->getMock(); - $this->themeHandler = new TestThemeHandler($this->configFactory, $this->moduleHandler, $this->cacheBackend, $this->infoParser, $this->configInstaller, $this->routeBuilder, $this->systemListingInfo); + $this->themeHandler = new TestThemeHandler($this->configFactory, $this->moduleHandler, $this->cacheBackend, $this->infoParser, $this->configInstaller, $this->routeBuilder, $this->systemListing); $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); $container->expects($this->any()) @@ -154,7 +154,7 @@ public function testEnableSingleTheme() { ->expects($this->once()) ->method('save'); - $this->systemListingInfo->expects($this->any()) + $this->systemListing->expects($this->any()) ->method('scan') ->will($this->returnValue(array())); @@ -195,7 +195,7 @@ public function testEnableAndListInfo() { ->method('clear') ->will($this->returnSelf()); - $this->systemListingInfo->expects($this->any()) + $this->systemListing->expects($this->any()) ->method('scan') ->will($this->returnValue(array())); @@ -255,7 +255,7 @@ public function testEnableAndListInfo() { * @see \Drupal\Core\Extension\ThemeHandler::rebuildThemeData() */ public function testRebuildThemeData() { - $this->systemListingInfo->expects($this->at(0)) + $this->systemListing->expects($this->at(0)) ->method('scan') ->with($this->anything(), 'themes', 'name') ->will($this->returnValue(array(