diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index e2e8c27..2db1ce9 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1669,8 +1669,8 @@ function install_profile_modules(&$install_state) { $non_required[$module] = $files[$module]->sort; } } - arsort($required); - arsort($non_required); + //arsort($required); + //arsort($non_required); $operations = array(); foreach ($required + $non_required as $module => $weight) { diff --git a/core/includes/install.inc b/core/includes/install.inc index 088413a..dbeaf66 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -870,8 +870,11 @@ function drupal_check_module($module) { * in a normal Drupal module .info.yml file. For example: * - name: The real name of the installation profile for display purposes. * - description: A brief description of the profile. - * - dependencies: An array of shortnames of other modules that this install - * profile requires. + * - dependencies: An array of shortnames of modules that this install profile + * requires. These modules cannot be disabled later. + * - recommends: An array of shortnames of modules that this install profile + * should enable (if found) during installation. These modules can be disabled + * later. * * Additional, less commonly-used information that can appear in a * profile.info.yml file but not in a normal Drupal module .info.yml file @@ -896,6 +899,7 @@ function drupal_check_module($module) { * description = Start fresh, with only a few modules enabled. * dependencies[] = block * dependencies[] = dblog + * recommends[] = views * @endcode * * @param $profile @@ -913,6 +917,7 @@ function install_profile_info($profile, $langcode = 'en') { // Set defaults for module info. $defaults = array( 'dependencies' => array(), + 'recommends' => array(), 'description' => '', 'distribution_name' => 'Drupal', 'version' => NULL, @@ -925,6 +930,7 @@ function install_profile_info($profile, $langcode = 'en') { $info['dependencies'] = array_unique(array_merge( drupal_required_modules(), $info['dependencies'], + $info['recommends'], ($langcode != 'en' && !empty($langcode) ? array('locale') : array())) ); diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index 4cc4e9f..85676ba 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -170,22 +170,46 @@ public function getBootstrapModules() { * Implements \Drupal\Core\Extension\ModuleHandlerInterface::buildModuleDependencies(). */ public function buildModuleDependencies(array $modules) { + $dependencies_graph = array(); + $recommendations_graph = array(); + foreach ($modules as $name => $module) { - $graph[$module->name]['edges'] = array(); + $dependencies_graph[$module->name]['edges'] = array(); + $recommendations_graph[$module->name]['edges'] = array(); + + // Add information about dependencies to a graph. if (isset($module->info['dependencies']) && is_array($module->info['dependencies'])) { foreach ($module->info['dependencies'] as $dependency) { - $dependency_data = $this->parseDependency($dependency); - $graph[$module->name]['edges'][$dependency_data['name']] = $dependency_data; + $dependency_data = drupal_parse_dependency($dependency); + $dependencies_graph[$module->name]['edges'][$dependency_data['name']] = $dependency_data; + } + } + + // Add information about recommendations to a graph. + if (isset($module->info['recommends']) && is_array($module->info['recommends'])) { + foreach ($module->info['recommends'] as $recommendation) { + $recommendation_data = drupal_parse_dependency($recommendation); + $recommendations_graph[$module->name]['edges'][$recommendation_data['name']] = $recommendation_data; } } } - $graph_object = new Graph($graph); - $graph = $graph_object->searchAndSort(); - foreach ($graph as $module_name => $data) { - $modules[$module_name]->required_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); - $modules[$module_name]->requires = isset($data['paths']) ? $data['paths'] : array(); - $modules[$module_name]->sort = $data['weight']; + + $dependencies_graph_object = new Graph($dependencies_graph); + $dependencies_graph = $dependencies_graph_object->searchAndSort(); + foreach ($dependencies_graph as $module => $data) { + $modules[$module]->required_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); + $modules[$module]->requires = isset($data['paths']) ? $data['paths'] : array(); + $modules[$module]->sort = $data['weight']; + } + + $recommendations_graph_object = new Graph($recommendations_graph); + $recommendations_graph = $recommendations_graph_object->searchAndSort(); + foreach ($recommendations_graph as $module => $data) { + $modules[$module]->recommended_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); + $modules[$module]->recommends = isset($data['paths']) ? $data['paths'] : array(); + $modules[$module]->sort = $data['weight']; } + return $modules; } diff --git a/core/modules/aggregator/aggregator.info.yml b/core/modules/aggregator/aggregator.info.yml index 4cade24..93bbfdf 100644 --- a/core/modules/aggregator/aggregator.info.yml +++ b/core/modules/aggregator/aggregator.info.yml @@ -6,3 +6,5 @@ core: 8.x configure: admin/config/services/aggregator/settings dependencies: - file +recommends: + - views diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 882a049..9d953f2 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -450,8 +450,8 @@ function system_requirements($phase) { $profile = drupal_get_profile(); $files = system_rebuild_module_data(); foreach ($files as $module => $file) { - // Ignore disabled modules and installation profiles. - if (!$file->status || $module == $profile) { + // Ignore disabled modules. + if (!$file->status) { continue; } // Check the module's PHP version. diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 2c51ae0..0274d28 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2842,6 +2842,7 @@ function _system_rebuild_module_data() { // Set defaults for module info. $defaults = array( 'dependencies' => array(), + 'recommends' => array(), 'description' => '', 'package' => 'Other', 'version' => NULL, diff --git a/core/profiles/minimal/minimal.info.yml b/core/profiles/minimal/minimal.info.yml index 948aeb4..491285f 100644 --- a/core/profiles/minimal/minimal.info.yml +++ b/core/profiles/minimal/minimal.info.yml @@ -2,7 +2,7 @@ name: Minimal description: 'Build a custom site without pre-configured functionality. Suitable for advanced users.' version: VERSION core: 8.x -dependencies: +recommends: - node - block - dblog diff --git a/core/profiles/standard/standard.info.yml b/core/profiles/standard/standard.info.yml index a0ff1f9..f77e0c3 100644 --- a/core/profiles/standard/standard.info.yml +++ b/core/profiles/standard/standard.info.yml @@ -2,7 +2,7 @@ name: Standard description: 'Install with commonly used features pre-configured.' version: VERSION core: 8.x -dependencies: +recommends: - node - history - block