diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 87924987c2..0f5eded9db 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -505,30 +505,34 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { * The name of the module for which to remove all registered cache bins. */ protected function removeCacheBins($module) { + // Remove any cache bins defined by a module. $service_yaml_file = drupal_get_path('module', $module) . "/$module.services.yml"; - if (!file_exists($service_yaml_file)) { - return; - } - - $definitions = Yaml::decode(file_get_contents($service_yaml_file)); - - $cache_bin_services = array_filter( - isset($definitions['services']) ? $definitions['services'] : [], - function ($definition) { - $tags = isset($definition['tags']) ? $definition['tags'] : []; - foreach ($tags as $tag) { - if (isset($tag['name']) && ($tag['name'] == 'cache.bin')) { - return TRUE; + if (file_exists($service_yaml_file)) { + $definitions = Yaml::decode(file_get_contents($service_yaml_file)); + if (isset($definitions['services'])) { + foreach ($definitions['services'] as $id => $definition) { + if (isset($definition['tags'])) { + foreach ($definition['tags'] as $tag) { + // This works for the default cache registration and even in some + // cases when a non-default "super" factory is used. That should + // be extremely rare. + if ($tag['name'] == 'cache.bin' && isset($definition['factory_service']) && isset($definition['factory_method']) && !empty($definition['arguments'])) { + try { + $factory = \Drupal::service($definition['factory_service']); + if (method_exists($factory, $definition['factory_method'])) { + $backend = call_user_func_array([$factory, $definition['factory_method']], $definition['arguments']); + if ($backend instanceof CacheBackendInterface) { + $backend->removeBin(); + } + } + } + catch (\Exception $e) { + watchdog_exception('system', $e, 'Failed to remove cache bin defined by the service %id.', ['%id' => $id]); + } + } + } } } - return FALSE; - } - ); - - foreach (array_keys($cache_bin_services) as $service_id) { - $backend = $this->kernel->getContainer()->get($service_id); - if ($backend instanceof CacheBackendInterface) { - $backend->removeBin(); } } } diff --git a/core/modules/action/migrations/action_settings.yml b/core/modules/action/migration_templates/action_settings.yml similarity index 100% rename from core/modules/action/migrations/action_settings.yml rename to core/modules/action/migration_templates/action_settings.yml diff --git a/core/modules/action/migrations/d6_action.yml b/core/modules/action/migration_templates/d6_action.yml similarity index 100% rename from core/modules/action/migrations/d6_action.yml rename to core/modules/action/migration_templates/d6_action.yml diff --git a/core/modules/action/migrations/d7_action.yml b/core/modules/action/migration_templates/d7_action.yml similarity index 100% rename from core/modules/action/migrations/d7_action.yml rename to core/modules/action/migration_templates/d7_action.yml diff --git a/core/modules/aggregator/migrations/d6_aggregator_feed.yml b/core/modules/aggregator/migration_templates/d6_aggregator_feed.yml similarity index 100% rename from core/modules/aggregator/migrations/d6_aggregator_feed.yml rename to core/modules/aggregator/migration_templates/d6_aggregator_feed.yml diff --git a/core/modules/aggregator/migrations/d6_aggregator_item.yml b/core/modules/aggregator/migration_templates/d6_aggregator_item.yml similarity index 100% rename from core/modules/aggregator/migrations/d6_aggregator_item.yml rename to core/modules/aggregator/migration_templates/d6_aggregator_item.yml diff --git a/core/modules/aggregator/migrations/d6_aggregator_settings.yml b/core/modules/aggregator/migration_templates/d6_aggregator_settings.yml similarity index 100% rename from core/modules/aggregator/migrations/d6_aggregator_settings.yml rename to core/modules/aggregator/migration_templates/d6_aggregator_settings.yml diff --git a/core/modules/aggregator/migrations/d7_aggregator_feed.yml b/core/modules/aggregator/migration_templates/d7_aggregator_feed.yml similarity index 100% rename from core/modules/aggregator/migrations/d7_aggregator_feed.yml rename to core/modules/aggregator/migration_templates/d7_aggregator_feed.yml diff --git a/core/modules/aggregator/migrations/d7_aggregator_item.yml b/core/modules/aggregator/migration_templates/d7_aggregator_item.yml similarity index 100% rename from core/modules/aggregator/migrations/d7_aggregator_item.yml rename to core/modules/aggregator/migration_templates/d7_aggregator_item.yml diff --git a/core/modules/aggregator/migrations/d7_aggregator_settings.yml b/core/modules/aggregator/migration_templates/d7_aggregator_settings.yml similarity index 100% rename from core/modules/aggregator/migrations/d7_aggregator_settings.yml rename to core/modules/aggregator/migration_templates/d7_aggregator_settings.yml diff --git a/core/modules/ban/migrations/d7_blocked_ips.yml b/core/modules/ban/migration_templates/d7_blocked_ips.yml similarity index 100% rename from core/modules/ban/migrations/d7_blocked_ips.yml rename to core/modules/ban/migration_templates/d7_blocked_ips.yml diff --git a/core/modules/block/migrations/d6_block.yml b/core/modules/block/migration_templates/d6_block.yml similarity index 100% rename from core/modules/block/migrations/d6_block.yml rename to core/modules/block/migration_templates/d6_block.yml diff --git a/core/modules/block/migrations/d7_block.yml b/core/modules/block/migration_templates/d7_block.yml similarity index 100% rename from core/modules/block/migrations/d7_block.yml rename to core/modules/block/migration_templates/d7_block.yml diff --git a/core/modules/block_content/migrations/block_content_body_field.yml b/core/modules/block_content/migration_templates/block_content_body_field.yml similarity index 100% rename from core/modules/block_content/migrations/block_content_body_field.yml rename to core/modules/block_content/migration_templates/block_content_body_field.yml diff --git a/core/modules/block_content/migrations/block_content_entity_display.yml b/core/modules/block_content/migration_templates/block_content_entity_display.yml similarity index 100% rename from core/modules/block_content/migrations/block_content_entity_display.yml rename to core/modules/block_content/migration_templates/block_content_entity_display.yml diff --git a/core/modules/block_content/migrations/block_content_entity_form_display.yml b/core/modules/block_content/migration_templates/block_content_entity_form_display.yml similarity index 100% rename from core/modules/block_content/migrations/block_content_entity_form_display.yml rename to core/modules/block_content/migration_templates/block_content_entity_form_display.yml diff --git a/core/modules/block_content/migrations/block_content_type.yml b/core/modules/block_content/migration_templates/block_content_type.yml similarity index 100% rename from core/modules/block_content/migrations/block_content_type.yml rename to core/modules/block_content/migration_templates/block_content_type.yml diff --git a/core/modules/block_content/migrations/d6_custom_block.yml b/core/modules/block_content/migration_templates/d6_custom_block.yml similarity index 100% rename from core/modules/block_content/migrations/d6_custom_block.yml rename to core/modules/block_content/migration_templates/d6_custom_block.yml diff --git a/core/modules/block_content/migrations/d7_custom_block.yml b/core/modules/block_content/migration_templates/d7_custom_block.yml similarity index 100% rename from core/modules/block_content/migrations/d7_custom_block.yml rename to core/modules/block_content/migration_templates/d7_custom_block.yml diff --git a/core/modules/book/migrations/d6_book.yml b/core/modules/book/migration_templates/d6_book.yml similarity index 100% rename from core/modules/book/migrations/d6_book.yml rename to core/modules/book/migration_templates/d6_book.yml diff --git a/core/modules/book/migrations/d6_book_settings.yml b/core/modules/book/migration_templates/d6_book_settings.yml similarity index 100% rename from core/modules/book/migrations/d6_book_settings.yml rename to core/modules/book/migration_templates/d6_book_settings.yml diff --git a/core/modules/comment/migrations/d6_comment.yml b/core/modules/comment/migration_templates/d6_comment.yml similarity index 100% rename from core/modules/comment/migrations/d6_comment.yml rename to core/modules/comment/migration_templates/d6_comment.yml diff --git a/core/modules/comment/migrations/d6_comment_entity_display.yml b/core/modules/comment/migration_templates/d6_comment_entity_display.yml similarity index 100% rename from core/modules/comment/migrations/d6_comment_entity_display.yml rename to core/modules/comment/migration_templates/d6_comment_entity_display.yml diff --git a/core/modules/comment/migrations/d6_comment_entity_form_display.yml b/core/modules/comment/migration_templates/d6_comment_entity_form_display.yml similarity index 100% rename from core/modules/comment/migrations/d6_comment_entity_form_display.yml rename to core/modules/comment/migration_templates/d6_comment_entity_form_display.yml diff --git a/core/modules/comment/migrations/d6_comment_entity_form_display_subject.yml b/core/modules/comment/migration_templates/d6_comment_entity_form_display_subject.yml similarity index 100% rename from core/modules/comment/migrations/d6_comment_entity_form_display_subject.yml rename to core/modules/comment/migration_templates/d6_comment_entity_form_display_subject.yml diff --git a/core/modules/comment/migrations/d6_comment_field.yml b/core/modules/comment/migration_templates/d6_comment_field.yml similarity index 100% rename from core/modules/comment/migrations/d6_comment_field.yml rename to core/modules/comment/migration_templates/d6_comment_field.yml diff --git a/core/modules/comment/migrations/d6_comment_field_instance.yml b/core/modules/comment/migration_templates/d6_comment_field_instance.yml similarity index 100% rename from core/modules/comment/migrations/d6_comment_field_instance.yml rename to core/modules/comment/migration_templates/d6_comment_field_instance.yml diff --git a/core/modules/comment/migrations/d6_comment_type.yml b/core/modules/comment/migration_templates/d6_comment_type.yml similarity index 100% rename from core/modules/comment/migrations/d6_comment_type.yml rename to core/modules/comment/migration_templates/d6_comment_type.yml diff --git a/core/modules/comment/migrations/d7_comment.yml b/core/modules/comment/migration_templates/d7_comment.yml similarity index 100% rename from core/modules/comment/migrations/d7_comment.yml rename to core/modules/comment/migration_templates/d7_comment.yml diff --git a/core/modules/comment/migrations/d7_comment_entity_display.yml b/core/modules/comment/migration_templates/d7_comment_entity_display.yml similarity index 100% rename from core/modules/comment/migrations/d7_comment_entity_display.yml rename to core/modules/comment/migration_templates/d7_comment_entity_display.yml diff --git a/core/modules/comment/migrations/d7_comment_entity_form_display.yml b/core/modules/comment/migration_templates/d7_comment_entity_form_display.yml similarity index 100% rename from core/modules/comment/migrations/d7_comment_entity_form_display.yml rename to core/modules/comment/migration_templates/d7_comment_entity_form_display.yml diff --git a/core/modules/comment/migrations/d7_comment_entity_form_display_subject.yml b/core/modules/comment/migration_templates/d7_comment_entity_form_display_subject.yml similarity index 100% rename from core/modules/comment/migrations/d7_comment_entity_form_display_subject.yml rename to core/modules/comment/migration_templates/d7_comment_entity_form_display_subject.yml diff --git a/core/modules/comment/migrations/d7_comment_field.yml b/core/modules/comment/migration_templates/d7_comment_field.yml similarity index 100% rename from core/modules/comment/migrations/d7_comment_field.yml rename to core/modules/comment/migration_templates/d7_comment_field.yml diff --git a/core/modules/comment/migrations/d7_comment_field_instance.yml b/core/modules/comment/migration_templates/d7_comment_field_instance.yml similarity index 100% rename from core/modules/comment/migrations/d7_comment_field_instance.yml rename to core/modules/comment/migration_templates/d7_comment_field_instance.yml diff --git a/core/modules/comment/migrations/d7_comment_type.yml b/core/modules/comment/migration_templates/d7_comment_type.yml similarity index 100% rename from core/modules/comment/migrations/d7_comment_type.yml rename to core/modules/comment/migration_templates/d7_comment_type.yml diff --git a/core/modules/config_translation/migrations/d6_system_maintenance_translation.yml b/core/modules/config_translation/migration_templates/d6_system_maintenance_translation.yml similarity index 100% rename from core/modules/config_translation/migrations/d6_system_maintenance_translation.yml rename to core/modules/config_translation/migration_templates/d6_system_maintenance_translation.yml diff --git a/core/modules/config_translation/migrations/d6_system_site_translation.yml b/core/modules/config_translation/migration_templates/d6_system_site_translation.yml similarity index 100% rename from core/modules/config_translation/migrations/d6_system_site_translation.yml rename to core/modules/config_translation/migration_templates/d6_system_site_translation.yml diff --git a/core/modules/config_translation/migrations/d6_user_mail_translation.yml b/core/modules/config_translation/migration_templates/d6_user_mail_translation.yml similarity index 100% rename from core/modules/config_translation/migrations/d6_user_mail_translation.yml rename to core/modules/config_translation/migration_templates/d6_user_mail_translation.yml diff --git a/core/modules/config_translation/migrations/d6_user_profile_field_instance_translation.yml b/core/modules/config_translation/migration_templates/d6_user_profile_field_instance_translation.yml similarity index 100% rename from core/modules/config_translation/migrations/d6_user_profile_field_instance_translation.yml rename to core/modules/config_translation/migration_templates/d6_user_profile_field_instance_translation.yml diff --git a/core/modules/config_translation/migrations/d6_user_settings_translation.yml b/core/modules/config_translation/migration_templates/d6_user_settings_translation.yml similarity index 100% rename from core/modules/config_translation/migrations/d6_user_settings_translation.yml rename to core/modules/config_translation/migration_templates/d6_user_settings_translation.yml diff --git a/core/modules/contact/migrations/contact_category.yml b/core/modules/contact/migration_templates/contact_category.yml similarity index 100% rename from core/modules/contact/migrations/contact_category.yml rename to core/modules/contact/migration_templates/contact_category.yml diff --git a/core/modules/contact/migrations/d6_contact_settings.yml b/core/modules/contact/migration_templates/d6_contact_settings.yml similarity index 100% rename from core/modules/contact/migrations/d6_contact_settings.yml rename to core/modules/contact/migration_templates/d6_contact_settings.yml diff --git a/core/modules/contact/migrations/d7_contact_settings.yml b/core/modules/contact/migration_templates/d7_contact_settings.yml similarity index 100% rename from core/modules/contact/migrations/d7_contact_settings.yml rename to core/modules/contact/migration_templates/d7_contact_settings.yml diff --git a/core/modules/dblog/migrations/d6_dblog_settings.yml b/core/modules/dblog/migration_templates/d6_dblog_settings.yml similarity index 100% rename from core/modules/dblog/migrations/d6_dblog_settings.yml rename to core/modules/dblog/migration_templates/d6_dblog_settings.yml diff --git a/core/modules/dblog/migrations/d7_dblog_settings.yml b/core/modules/dblog/migration_templates/d7_dblog_settings.yml similarity index 100% rename from core/modules/dblog/migrations/d7_dblog_settings.yml rename to core/modules/dblog/migration_templates/d7_dblog_settings.yml diff --git a/core/modules/field/migrations/d6_field.yml b/core/modules/field/migration_templates/d6_field.yml similarity index 100% rename from core/modules/field/migrations/d6_field.yml rename to core/modules/field/migration_templates/d6_field.yml diff --git a/core/modules/field/migrations/d6_field_formatter_settings.yml b/core/modules/field/migration_templates/d6_field_formatter_settings.yml similarity index 100% rename from core/modules/field/migrations/d6_field_formatter_settings.yml rename to core/modules/field/migration_templates/d6_field_formatter_settings.yml diff --git a/core/modules/field/migrations/d6_field_instance.yml b/core/modules/field/migration_templates/d6_field_instance.yml similarity index 100% rename from core/modules/field/migrations/d6_field_instance.yml rename to core/modules/field/migration_templates/d6_field_instance.yml diff --git a/core/modules/field/migrations/d6_field_instance_widget_settings.yml b/core/modules/field/migration_templates/d6_field_instance_widget_settings.yml similarity index 100% rename from core/modules/field/migrations/d6_field_instance_widget_settings.yml rename to core/modules/field/migration_templates/d6_field_instance_widget_settings.yml diff --git a/core/modules/field/migrations/d7_field.yml b/core/modules/field/migration_templates/d7_field.yml similarity index 100% rename from core/modules/field/migrations/d7_field.yml rename to core/modules/field/migration_templates/d7_field.yml diff --git a/core/modules/field/migrations/d7_field_formatter_settings.yml b/core/modules/field/migration_templates/d7_field_formatter_settings.yml similarity index 100% rename from core/modules/field/migrations/d7_field_formatter_settings.yml rename to core/modules/field/migration_templates/d7_field_formatter_settings.yml diff --git a/core/modules/field/migrations/d7_field_instance.yml b/core/modules/field/migration_templates/d7_field_instance.yml similarity index 100% rename from core/modules/field/migrations/d7_field_instance.yml rename to core/modules/field/migration_templates/d7_field_instance.yml diff --git a/core/modules/field/migrations/d7_field_instance_widget_settings.yml b/core/modules/field/migration_templates/d7_field_instance_widget_settings.yml similarity index 100% rename from core/modules/field/migrations/d7_field_instance_widget_settings.yml rename to core/modules/field/migration_templates/d7_field_instance_widget_settings.yml diff --git a/core/modules/field/migrations/d7_view_modes.yml b/core/modules/field/migration_templates/d7_view_modes.yml similarity index 100% rename from core/modules/field/migrations/d7_view_modes.yml rename to core/modules/field/migration_templates/d7_view_modes.yml diff --git a/core/modules/field/tests/src/Kernel/FieldDefinitionIntegrityTest.php b/core/modules/field/tests/src/Kernel/FieldDefinitionIntegrityTest.php index afd468a5da..85d6b0bfc4 100644 --- a/core/modules/field/tests/src/Kernel/FieldDefinitionIntegrityTest.php +++ b/core/modules/field/tests/src/Kernel/FieldDefinitionIntegrityTest.php @@ -2,13 +2,8 @@ namespace Drupal\Tests\field\Kernel; -use Drupal\Component\Plugin\Discovery\DiscoveryInterface; -use Drupal\Component\Plugin\Exception\PluginNotFoundException; use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Extension\Extension; -use Drupal\Core\Field\BaseFieldDefinition; use Drupal\KernelTests\KernelTestBase; /** @@ -29,11 +24,26 @@ class FieldDefinitionIntegrityTest extends KernelTestBase { public function testFieldPluginDefinitionIntegrity() { // Enable all core modules that provide field plugins, and their // dependencies. - $this->enableModules( - $this->modulesWithSubdirectory( - 'src' . DIRECTORY_SEPARATOR . 'Plugin' . DIRECTORY_SEPARATOR . 'Field' - ) - ); + $modules = system_rebuild_module_data(); + $modules = array_filter($modules, function (Extension $module) { + // Filter contrib, hidden, already enabled modules and modules in the + // Testing package. + if ($module->origin === 'core' + && empty($module->info['hidden']) + && $module->status == FALSE + && $module->info['package'] !== 'Testing' + && is_readable($module->getPath() . '/src/Plugin/Field')) { + return TRUE; + } + return FALSE; + }); + // Gather the dependencies of the modules. + $dependencies = NestedArray::mergeDeepArray(array_map(function (Extension $module) { + return array_keys($module->requires); + }, $modules)); + $modules = array_unique(NestedArray::mergeDeep(array_keys($modules), $dependencies)); + + $this->enableModules($modules); /** @var \Drupal\Component\Plugin\Discovery\DiscoveryInterface $field_type_manager */ $field_type_manager = \Drupal::service('plugin.manager.field.field_type'); @@ -105,114 +115,7 @@ public function testFieldPluginDefinitionIntegrity() { else { $this->pass(sprintf('Field formatter %s integrates with existing field types.', $definition['id'])); } - } } - /** - * Tests to load field plugin definitions used in core's existing entities. - */ - public function testFieldPluginDefinitionAvailability() { - $this->enableModules( - $this->modulesWithSubdirectory('src' . DIRECTORY_SEPARATOR . 'Entity') - ); - - /** @var \Drupal\Component\Plugin\Discovery\DiscoveryInterface $field_type_manager */ - $field_formatter_manager = $this->container->get('plugin.manager.field.formatter'); - - /** @var \Drupal\Component\Plugin\Discovery\DiscoveryInterface $field_type_manager */ - $field_widget_manager = $this->container->get('plugin.manager.field.widget'); - - /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */ - $entity_field_manager = $this->container->get('entity_field.manager'); - - /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */ - $entity_type_manager = $this->container->get('entity_type.manager'); - - /** @var \Drupal\Core\Field\BaseFieldDefinition[][] $field_definitions */ - $field_definitions = []; - - /** @var \Drupal\Core\Entity\EntityTypeInterface[] $content_entity_types */ - $content_entity_types = array_filter($entity_type_manager->getDefinitions(), function (EntityTypeInterface $entity_type) { - return $entity_type instanceof ContentEntityTypeInterface; - }); - - foreach ($content_entity_types as $entity_type_id => $entity_type_definition) { - $field_definitions[$entity_type_id] = $entity_field_manager->getBaseFieldDefinitions($entity_type_id); - } - - foreach ($field_definitions as $entity_type_id => $definitions) { - foreach ($definitions as $field_id => $field_definition) { - $this->checkDisplayOption($entity_type_id, $field_id, $field_definition, $field_formatter_manager, 'view'); - $this->checkDisplayOption($entity_type_id, $field_id, $field_definition, $field_widget_manager, 'form'); - } - } - } - - /** - * Helper method that tries to load plugin definitions. - * - * @param string $entity_type_id - * Id of entity type. Required by message. - * @param string $field_id - * Id of field. Required by message. - * @param \Drupal\Core\Field\BaseFieldDefinition $field_definition - * Field definition that provide display options. - * @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface $plugin_manager - * Plugin manager that will try to provide plugin definition. - * @param string $display_context - * Defines which display options should be loaded. - */ - protected function checkDisplayOption($entity_type_id, $field_id, BaseFieldDefinition $field_definition, DiscoveryInterface $plugin_manager, $display_context) { - $display_options = $field_definition->getDisplayOptions($display_context); - if (!empty($display_options['type'])) { - try { - $plugin_manager->getDefinition($display_options['type']); - } - catch (PluginNotFoundException $e) { - $this->fail(sprintf( - 'PluginNotFoundException here for "%s" field %s display options of "%s" entity type. Original message: %s', - $field_id, - $display_context, - $entity_type_id, - $e->getMessage() - )); - } - } - } - - /** - * Find modules with a specified subdirectory. - * - * @param string $subdirectory - * The required path, relative to the module directory. - * - * @return string[] - * A list of module names satisfying these criteria: - * - provided by core - * - not hidden - * - not already enabled - * - not in the Testing package - * - containing the required $subdirectory - * and all modules required by any of these modules. - */ - protected function modulesWithSubdirectory($subdirectory) { - $modules = system_rebuild_module_data(); - $modules = array_filter($modules, function (Extension $module) use ($subdirectory) { - // Filter contrib, hidden, already enabled modules and modules in the - // Testing package. - return ($module->origin === 'core' - && empty($module->info['hidden']) - && $module->status == FALSE - && $module->info['package'] !== 'Testing' - && is_readable($module->getPath() . DIRECTORY_SEPARATOR . $subdirectory)); - }); - // Gather the dependencies of the modules. - $dependencies = NestedArray::mergeDeepArray(array_map(function (Extension $module) { - return array_keys($module->requires); - }, $modules)); - - return array_unique(NestedArray::mergeDeep(array_keys($modules), $dependencies)); - } - } diff --git a/core/modules/file/migrations/d6_file.yml b/core/modules/file/migration_templates/d6_file.yml similarity index 100% rename from core/modules/file/migrations/d6_file.yml rename to core/modules/file/migration_templates/d6_file.yml diff --git a/core/modules/file/migrations/d6_upload.yml b/core/modules/file/migration_templates/d6_upload.yml similarity index 100% rename from core/modules/file/migrations/d6_upload.yml rename to core/modules/file/migration_templates/d6_upload.yml diff --git a/core/modules/file/migrations/d6_upload_entity_display.yml b/core/modules/file/migration_templates/d6_upload_entity_display.yml similarity index 100% rename from core/modules/file/migrations/d6_upload_entity_display.yml rename to core/modules/file/migration_templates/d6_upload_entity_display.yml diff --git a/core/modules/file/migrations/d6_upload_entity_form_display.yml b/core/modules/file/migration_templates/d6_upload_entity_form_display.yml similarity index 100% rename from core/modules/file/migrations/d6_upload_entity_form_display.yml rename to core/modules/file/migration_templates/d6_upload_entity_form_display.yml diff --git a/core/modules/file/migrations/d6_upload_field.yml b/core/modules/file/migration_templates/d6_upload_field.yml similarity index 100% rename from core/modules/file/migrations/d6_upload_field.yml rename to core/modules/file/migration_templates/d6_upload_field.yml diff --git a/core/modules/file/migrations/d6_upload_field_instance.yml b/core/modules/file/migration_templates/d6_upload_field_instance.yml similarity index 100% rename from core/modules/file/migrations/d6_upload_field_instance.yml rename to core/modules/file/migration_templates/d6_upload_field_instance.yml diff --git a/core/modules/file/migrations/d7_file.yml b/core/modules/file/migration_templates/d7_file.yml similarity index 100% rename from core/modules/file/migrations/d7_file.yml rename to core/modules/file/migration_templates/d7_file.yml diff --git a/core/modules/file/migrations/d7_file_private.yml b/core/modules/file/migration_templates/d7_file_private.yml similarity index 100% rename from core/modules/file/migrations/d7_file_private.yml rename to core/modules/file/migration_templates/d7_file_private.yml diff --git a/core/modules/file/migrations/file_settings.yml b/core/modules/file/migration_templates/file_settings.yml similarity index 100% rename from core/modules/file/migrations/file_settings.yml rename to core/modules/file/migration_templates/file_settings.yml diff --git a/core/modules/filter/migrations/d6_filter_format.yml b/core/modules/filter/migration_templates/d6_filter_format.yml similarity index 100% rename from core/modules/filter/migrations/d6_filter_format.yml rename to core/modules/filter/migration_templates/d6_filter_format.yml diff --git a/core/modules/filter/migrations/d7_filter_format.yml b/core/modules/filter/migration_templates/d7_filter_format.yml similarity index 100% rename from core/modules/filter/migrations/d7_filter_format.yml rename to core/modules/filter/migration_templates/d7_filter_format.yml diff --git a/core/modules/filter/migrations/d7_filter_settings.yml b/core/modules/filter/migration_templates/d7_filter_settings.yml similarity index 100% rename from core/modules/filter/migrations/d7_filter_settings.yml rename to core/modules/filter/migration_templates/d7_filter_settings.yml diff --git a/core/modules/forum/migrations/d6_forum_settings.yml b/core/modules/forum/migration_templates/d6_forum_settings.yml similarity index 100% rename from core/modules/forum/migrations/d6_forum_settings.yml rename to core/modules/forum/migration_templates/d6_forum_settings.yml diff --git a/core/modules/forum/migrations/d7_forum_settings.yml b/core/modules/forum/migration_templates/d7_forum_settings.yml similarity index 100% rename from core/modules/forum/migrations/d7_forum_settings.yml rename to core/modules/forum/migration_templates/d7_forum_settings.yml diff --git a/core/modules/hal/tests/src/Functional/EntityResource/EntityTest/EntityTestHalJsonInternalPropertyNormalizerTest.php b/core/modules/hal/tests/src/Functional/EntityResource/EntityTest/EntityTestHalJsonInternalPropertyNormalizerTest.php index 819a125f82..8ee3215571 100644 --- a/core/modules/hal/tests/src/Functional/EntityResource/EntityTest/EntityTestHalJsonInternalPropertyNormalizerTest.php +++ b/core/modules/hal/tests/src/Functional/EntityResource/EntityTest/EntityTestHalJsonInternalPropertyNormalizerTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\hal\Functional\EntityResource\EntityTest; -use Drupal\Core\Cache\Cache; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait; @@ -83,18 +82,4 @@ protected function getNormalizedPostEntity() { ]; } - /** - * {@inheritdoc} - */ - protected function getExpectedCacheContexts() { - return Cache::mergeContexts(parent::getExpectedCacheContexts(), ['request_format']); - } - - /** - * {@inheritdoc} - */ - protected function getExpectedCacheTags() { - return Cache::mergeTags(parent::getExpectedCacheTags(), ['you_are_it', 'no_tag_backs']); - } - } diff --git a/core/modules/image/migrations/d6_imagecache_presets.yml b/core/modules/image/migration_templates/d6_imagecache_presets.yml similarity index 100% rename from core/modules/image/migrations/d6_imagecache_presets.yml rename to core/modules/image/migration_templates/d6_imagecache_presets.yml diff --git a/core/modules/image/migrations/d7_image_settings.yml b/core/modules/image/migration_templates/d7_image_settings.yml similarity index 100% rename from core/modules/image/migrations/d7_image_settings.yml rename to core/modules/image/migration_templates/d7_image_settings.yml diff --git a/core/modules/image/migrations/d7_image_styles.yml b/core/modules/image/migration_templates/d7_image_styles.yml similarity index 100% rename from core/modules/image/migrations/d7_image_styles.yml rename to core/modules/image/migration_templates/d7_image_styles.yml diff --git a/core/modules/language/migrations/d6_language_content_settings.yml b/core/modules/language/migration_templates/d6_language_content_settings.yml similarity index 100% rename from core/modules/language/migrations/d6_language_content_settings.yml rename to core/modules/language/migration_templates/d6_language_content_settings.yml diff --git a/core/modules/language/migrations/d6_language_negotiation_settings.yml b/core/modules/language/migration_templates/d6_language_negotiation_settings.yml similarity index 100% rename from core/modules/language/migrations/d6_language_negotiation_settings.yml rename to core/modules/language/migration_templates/d6_language_negotiation_settings.yml diff --git a/core/modules/language/migrations/d6_language_types.yml b/core/modules/language/migration_templates/d6_language_types.yml similarity index 100% rename from core/modules/language/migrations/d6_language_types.yml rename to core/modules/language/migration_templates/d6_language_types.yml diff --git a/core/modules/language/migrations/d7_language_content_settings.yml b/core/modules/language/migration_templates/d7_language_content_settings.yml similarity index 100% rename from core/modules/language/migrations/d7_language_content_settings.yml rename to core/modules/language/migration_templates/d7_language_content_settings.yml diff --git a/core/modules/language/migrations/d7_language_negotiation_settings.yml b/core/modules/language/migration_templates/d7_language_negotiation_settings.yml similarity index 100% rename from core/modules/language/migrations/d7_language_negotiation_settings.yml rename to core/modules/language/migration_templates/d7_language_negotiation_settings.yml diff --git a/core/modules/language/migrations/d7_language_types.yml b/core/modules/language/migration_templates/d7_language_types.yml similarity index 100% rename from core/modules/language/migrations/d7_language_types.yml rename to core/modules/language/migration_templates/d7_language_types.yml diff --git a/core/modules/language/migrations/default_language.yml b/core/modules/language/migration_templates/default_language.yml similarity index 100% rename from core/modules/language/migrations/default_language.yml rename to core/modules/language/migration_templates/default_language.yml diff --git a/core/modules/language/migrations/language.yml b/core/modules/language/migration_templates/language.yml similarity index 100% rename from core/modules/language/migrations/language.yml rename to core/modules/language/migration_templates/language.yml diff --git a/core/modules/language/migrations/language_prefixes_and_domains.yml b/core/modules/language/migration_templates/language_prefixes_and_domains.yml similarity index 100% rename from core/modules/language/migrations/language_prefixes_and_domains.yml rename to core/modules/language/migration_templates/language_prefixes_and_domains.yml diff --git a/core/modules/locale/migrations/locale_settings.yml b/core/modules/locale/migration_templates/locale_settings.yml similarity index 100% rename from core/modules/locale/migrations/locale_settings.yml rename to core/modules/locale/migration_templates/locale_settings.yml diff --git a/core/modules/menu_link_content/migrations/d6_menu_links.yml b/core/modules/menu_link_content/migration_templates/d6_menu_links.yml similarity index 100% rename from core/modules/menu_link_content/migrations/d6_menu_links.yml rename to core/modules/menu_link_content/migration_templates/d6_menu_links.yml diff --git a/core/modules/menu_link_content/migrations/d7_menu_links.yml b/core/modules/menu_link_content/migration_templates/d7_menu_links.yml similarity index 100% rename from core/modules/menu_link_content/migrations/d7_menu_links.yml rename to core/modules/menu_link_content/migration_templates/d7_menu_links.yml diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index 460c0df0d4..d53ba49265 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -316,7 +316,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setDefaultValue(0) ->setDisplayOptions('view', [ 'label' => 'hidden', - 'type' => 'number_integer', + 'type' => 'integer', 'weight' => 0, ]) ->setDisplayOptions('form', [ diff --git a/core/modules/menu_ui/migrations/menu_settings.yml b/core/modules/menu_ui/migration_templates/menu_settings.yml similarity index 100% rename from core/modules/menu_ui/migrations/menu_settings.yml rename to core/modules/menu_ui/migration_templates/menu_settings.yml diff --git a/core/modules/migrate/migrate.api.php b/core/modules/migrate/migrate.api.php index c6130334d0..eefda3c384 100644 --- a/core/modules/migrate/migrate.api.php +++ b/core/modules/migrate/migrate.api.php @@ -38,8 +38,9 @@ * * @section sec_migrations Migration plugins * Migration plugin definitions are stored in a module's 'migrations' directory. + * For backwards compatibility we also scan the 'migration_templates' directory. * Examples of migration plugin definitions can be found in - * 'core/modules/action/migrations'. The plugin class is + * 'core/modules/action/migration_templates'. The plugin class is * \Drupal\migrate\Plugin\Migration, with interface * \Drupal\migrate\Plugin\MigrationInterface. Migration plugins are managed by * the \Drupal\migrate\Plugin\MigrationPluginManager class. Migration plugins diff --git a/core/modules/migrate/src/Plugin/MigrationPluginManager.php b/core/modules/migrate/src/Plugin/MigrationPluginManager.php index 55d4ec6bfd..b572bb5cc5 100644 --- a/core/modules/migrate/src/Plugin/MigrationPluginManager.php +++ b/core/modules/migrate/src/Plugin/MigrationPluginManager.php @@ -60,22 +60,11 @@ public function __construct(ModuleHandlerInterface $module_handler, CacheBackend } /** - * Gets the plugin discovery. - * - * This method overrides DefaultPluginManager::getDiscovery() in order to - * search for migration configurations in the MODULENAME/migrations and - * MODULENAME/migration_templates directories. Throws a deprecation notice if - * the MODULENAME/migration_templates directory exists. + * {@inheritdoc} */ protected function getDiscovery() { if (!isset($this->discovery)) { $directories = array_map(function ($directory) { - // Check for use of the @deprecated /migration_templates directory. - // @todo Remove use of /migration_templates in Drupal 9.0.0. - if (is_dir($directory . '/migration_templates')) { - @trigger_error('Use of the /migration_templates directory to store migration configuration files is deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2920988.', E_USER_DEPRECATED); - } - // But still accept configurations found in /migration_templates. return [$directory . '/migration_templates', $directory . '/migrations']; }, $this->moduleHandler->getModuleDirectories()); diff --git a/core/modules/migrate/tests/modules/migrate_high_water_test/migrations/migrate.migration.high_water_test.yml b/core/modules/migrate/tests/modules/migrate_high_water_test/migration_templates/migrate.migration.high_water_test.yml similarity index 100% rename from core/modules/migrate/tests/modules/migrate_high_water_test/migrations/migrate.migration.high_water_test.yml rename to core/modules/migrate/tests/modules/migrate_high_water_test/migration_templates/migrate.migration.high_water_test.yml diff --git a/core/modules/migrate/tests/modules/migration_directory_test/migration_directory_test.info.yml b/core/modules/migrate/tests/modules/migration_directory_test/migration_directory_test.info.yml deleted file mode 100644 index f0ca7c0aa6..0000000000 --- a/core/modules/migrate/tests/modules/migration_directory_test/migration_directory_test.info.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: 'Migration directory test' -type: module -package: Testing -version: VERSION -core: 8.x -dependencies: - - migrate diff --git a/core/modules/migrate/tests/modules/migration_directory_test/migration_templates/migration_templates_test.yml b/core/modules/migrate/tests/modules/migration_directory_test/migration_templates/migration_templates_test.yml deleted file mode 100644 index ebf9f9beb8..0000000000 --- a/core/modules/migrate/tests/modules/migration_directory_test/migration_templates/migration_templates_test.yml +++ /dev/null @@ -1,8 +0,0 @@ -id: migration_templates_test -label: Migration templates test -source: - plugin: embedded_data -process: - id: id -destination: - plugin: null diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationDirectoryTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationDirectoryTest.php deleted file mode 100644 index 427ca91a24..0000000000 --- a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationDirectoryTest.php +++ /dev/null @@ -1,29 +0,0 @@ -container->get('plugin.manager.migration'); - // Tests that a migration in directory 'migration_templates' is discovered. - $this->assertTrue($plugin_manager->hasDefinition('migration_templates_test')); - } - -} diff --git a/core/modules/migrate_drupal/tests/modules/migrate_overwrite_test/migrations/users.yml b/core/modules/migrate_drupal/tests/modules/migrate_overwrite_test/migration_templates/users.yml similarity index 100% rename from core/modules/migrate_drupal/tests/modules/migrate_overwrite_test/migrations/users.yml rename to core/modules/migrate_drupal/tests/modules/migrate_overwrite_test/migration_templates/users.yml diff --git a/core/modules/migrate_drupal_ui/tests/modules/migration_provider_test/migrations/migration_provider_no_annotation.yml b/core/modules/migrate_drupal_ui/tests/modules/migration_provider_test/migration_templates/migration_provider_no_annotation.yml similarity index 100% rename from core/modules/migrate_drupal_ui/tests/modules/migration_provider_test/migrations/migration_provider_no_annotation.yml rename to core/modules/migrate_drupal_ui/tests/modules/migration_provider_test/migration_templates/migration_provider_no_annotation.yml diff --git a/core/modules/migrate_drupal_ui/tests/modules/migration_provider_test/migrations/migration_provider_test.yml b/core/modules/migrate_drupal_ui/tests/modules/migration_provider_test/migration_templates/migration_provider_test.yml similarity index 100% rename from core/modules/migrate_drupal_ui/tests/modules/migration_provider_test/migrations/migration_provider_test.yml rename to core/modules/migrate_drupal_ui/tests/modules/migration_provider_test/migration_templates/migration_provider_test.yml diff --git a/core/modules/node/migrations/d6_node.yml b/core/modules/node/migration_templates/d6_node.yml similarity index 100% rename from core/modules/node/migrations/d6_node.yml rename to core/modules/node/migration_templates/d6_node.yml diff --git a/core/modules/node/migrations/d6_node_revision.yml b/core/modules/node/migration_templates/d6_node_revision.yml similarity index 100% rename from core/modules/node/migrations/d6_node_revision.yml rename to core/modules/node/migration_templates/d6_node_revision.yml diff --git a/core/modules/node/migrations/d6_node_setting_promote.yml b/core/modules/node/migration_templates/d6_node_setting_promote.yml similarity index 100% rename from core/modules/node/migrations/d6_node_setting_promote.yml rename to core/modules/node/migration_templates/d6_node_setting_promote.yml diff --git a/core/modules/node/migrations/d6_node_setting_status.yml b/core/modules/node/migration_templates/d6_node_setting_status.yml similarity index 100% rename from core/modules/node/migrations/d6_node_setting_status.yml rename to core/modules/node/migration_templates/d6_node_setting_status.yml diff --git a/core/modules/node/migrations/d6_node_setting_sticky.yml b/core/modules/node/migration_templates/d6_node_setting_sticky.yml similarity index 100% rename from core/modules/node/migrations/d6_node_setting_sticky.yml rename to core/modules/node/migration_templates/d6_node_setting_sticky.yml diff --git a/core/modules/node/migrations/d6_node_settings.yml b/core/modules/node/migration_templates/d6_node_settings.yml similarity index 100% rename from core/modules/node/migrations/d6_node_settings.yml rename to core/modules/node/migration_templates/d6_node_settings.yml diff --git a/core/modules/node/migrations/d6_node_translation.yml b/core/modules/node/migration_templates/d6_node_translation.yml similarity index 100% rename from core/modules/node/migrations/d6_node_translation.yml rename to core/modules/node/migration_templates/d6_node_translation.yml diff --git a/core/modules/node/migrations/d6_node_type.yml b/core/modules/node/migration_templates/d6_node_type.yml similarity index 100% rename from core/modules/node/migrations/d6_node_type.yml rename to core/modules/node/migration_templates/d6_node_type.yml diff --git a/core/modules/node/migrations/d6_view_modes.yml b/core/modules/node/migration_templates/d6_view_modes.yml similarity index 100% rename from core/modules/node/migrations/d6_view_modes.yml rename to core/modules/node/migration_templates/d6_view_modes.yml diff --git a/core/modules/node/migrations/d7_node.yml b/core/modules/node/migration_templates/d7_node.yml similarity index 100% rename from core/modules/node/migrations/d7_node.yml rename to core/modules/node/migration_templates/d7_node.yml diff --git a/core/modules/node/migrations/d7_node_revision.yml b/core/modules/node/migration_templates/d7_node_revision.yml similarity index 100% rename from core/modules/node/migrations/d7_node_revision.yml rename to core/modules/node/migration_templates/d7_node_revision.yml diff --git a/core/modules/node/migrations/d7_node_settings.yml b/core/modules/node/migration_templates/d7_node_settings.yml similarity index 100% rename from core/modules/node/migrations/d7_node_settings.yml rename to core/modules/node/migration_templates/d7_node_settings.yml diff --git a/core/modules/node/migrations/d7_node_title_label.yml b/core/modules/node/migration_templates/d7_node_title_label.yml similarity index 100% rename from core/modules/node/migrations/d7_node_title_label.yml rename to core/modules/node/migration_templates/d7_node_title_label.yml diff --git a/core/modules/node/migrations/d7_node_translation.yml b/core/modules/node/migration_templates/d7_node_translation.yml similarity index 100% rename from core/modules/node/migrations/d7_node_translation.yml rename to core/modules/node/migration_templates/d7_node_translation.yml diff --git a/core/modules/node/migrations/d7_node_type.yml b/core/modules/node/migration_templates/d7_node_type.yml similarity index 100% rename from core/modules/node/migrations/d7_node_type.yml rename to core/modules/node/migration_templates/d7_node_type.yml diff --git a/core/modules/node/node.permissions.yml b/core/modules/node/node.permissions.yml index e60102b331..289227c71a 100644 --- a/core/modules/node/node.permissions.yml +++ b/core/modules/node/node.permissions.yml @@ -12,6 +12,8 @@ administer nodes: restrict access: true access content overview: title: 'Access the Content overview page' +access content: + title: 'View published content' view own unpublished content: title: 'View own unpublished content' view all revisions: diff --git a/core/modules/path/migrations/d6_url_alias.yml b/core/modules/path/migration_templates/d6_url_alias.yml similarity index 100% rename from core/modules/path/migrations/d6_url_alias.yml rename to core/modules/path/migration_templates/d6_url_alias.yml diff --git a/core/modules/path/migrations/d7_url_alias.yml b/core/modules/path/migration_templates/d7_url_alias.yml similarity index 100% rename from core/modules/path/migrations/d7_url_alias.yml rename to core/modules/path/migration_templates/d7_url_alias.yml diff --git a/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php b/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php index babb238b45..ef33817ce8 100644 --- a/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php +++ b/core/modules/rest/src/EventSubscriber/ResourceResponseSubscriber.php @@ -2,7 +2,6 @@ namespace Drupal\rest\EventSubscriber; -use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\CacheableResponse; use Drupal\Core\Cache\CacheableResponseInterface; use Drupal\Core\Render\RenderContext; @@ -21,15 +20,6 @@ */ class ResourceResponseSubscriber implements EventSubscriberInterface { - /** - * Name of key for bubbling cacheability metadata via serialization context. - * - * @see \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize() - * @see \Symfony\Component\Serializer\SerializerInterface::serialize() - * @see \Drupal\rest\EventSubscriber\ResourceResponseSubscriber::renderResponseBody() - */ - const SERIALIZATION_CONTEXT_CACHEABILITY = 'cacheability'; - /** * The serializer. * @@ -138,19 +128,11 @@ public function getResponseFormat(RouteMatchInterface $route_match, Request $req /** * Renders a resource response body. * - * During serialization, encoders and normalizers are able to explicitly - * bubble cacheability metadata via the 'cacheability' key-value pair in the - * received context. This bubbled cacheability metadata will be applied to the - * the response. - * - * In versions of Drupal prior to 8.5, implicit bubbling of cacheability - * metadata was allowed because there was no explicit cacheability metadata - * bubbling API. To maintain backwards compatibility, we continue to support - * this, but support for this will be dropped in Drupal 9.0.0. This is - * especially useful when interacting with APIs that implicitly invoke - * rendering (for example: generating URLs): this allows those to "leak", and - * we collect their bubbled cacheability metadata automatically in a render - * context. + * Serialization can invoke rendering (e.g., generating URLs), but the + * serialization API does not provide a mechanism to collect the + * bubbleable metadata associated with that (e.g., language and other + * contexts), so instead, allow those to "leak" and collect them here in + * a render context. * * @param \Symfony\Component\HttpFoundation\Request $request * The request object. @@ -170,25 +152,14 @@ protected function renderResponseBody(Request $request, ResourceResponseInterfac // If there is data to send, serialize and set it as the response body. if ($data !== NULL) { - $serialization_context = [ - 'request' => $request, - static::SERIALIZATION_CONTEXT_CACHEABILITY => new CacheableMetadata(), - ]; - - // @deprecated In Drupal 8.5.0, will be removed before Drupal 9.0.0. Use - // explicit cacheability metadata bubbling instead. (The wrapping call to - // executeInRenderContext() will be removed before Drupal 9.0.0.) $context = new RenderContext(); $output = $this->renderer - ->executeInRenderContext($context, function () use ($serializer, $data, $format, $serialization_context) { - return $serializer->serialize($data, $format, $serialization_context); + ->executeInRenderContext($context, function () use ($serializer, $data, $format) { + return $serializer->serialize($data, $format); }); - if ($response instanceof CacheableResponseInterface) { - if (!$context->isEmpty()) { - @trigger_error('Implicit cacheability metadata bubbling (onto the global render context) in normalizers is deprecated since Drupal 8.5.0 and will be removed in Drupal 9.0.0. Use the "cacheability" serialization context instead, for explicit cacheability metadata bubbling. See https://www.drupal.org/node/2918937', E_USER_DEPRECATED); - $response->addCacheableDependency($context->pop()); - } - $response->addCacheableDependency($serialization_context[static::SERIALIZATION_CONTEXT_CACHEABILITY]); + + if ($response instanceof CacheableResponseInterface && !$context->isEmpty()) { + $response->addCacheableDependency($context->pop()); } $response->setContent($output); diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 6faf028c2b..41d9eec849 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -383,8 +383,18 @@ public function testGet() { // 200 for well-formed HEAD request. $response = $this->request('HEAD', $url, $request_options); $this->assertResourceResponse(200, '', $response); - $this->assertTrue($response->hasHeader('X-Drupal-Dynamic-Cache')); - $this->assertSame(['MISS'], $response->getHeader('X-Drupal-Dynamic-Cache')); + // @todo Entity resources with URLs that begin with '/admin/' are marked as + // administrative (see https://www.drupal.org/node/2874938), which + // excludes them from Dynamic Page Cache (see + // https://www.drupal.org/node/2877528). When either of those issues is + // fixed, remove the if-test and the 'else' block. + if (strpos($this->entity->getEntityType()->getLinkTemplate('canonical'), '/admin/') !== 0) { + $this->assertTrue($response->hasHeader('X-Drupal-Dynamic-Cache')); + $this->assertSame(['MISS'], $response->getHeader('X-Drupal-Dynamic-Cache')); + } + else { + $this->assertFalse($response->hasHeader('X-Drupal-Dynamic-Cache')); + } if (!$this->account) { $this->assertSame(['MISS'], $response->getHeader('X-Drupal-Cache')); } @@ -397,40 +407,50 @@ public function testGet() { // Same for Dynamic Page Cache hit. $response = $this->request('GET', $url, $request_options); $this->assertResourceResponse(200, FALSE, $response); - $this->assertTrue($response->hasHeader('X-Drupal-Dynamic-Cache')); - if (!static::$auth) { - $this->assertSame(['HIT'], $response->getHeader('X-Drupal-Cache')); - $this->assertSame(['MISS'], $response->getHeader('X-Drupal-Dynamic-Cache')); - } - else { - $this->assertFalse($response->hasHeader('X-Drupal-Cache')); - $this->assertSame(['HIT'], $response->getHeader('X-Drupal-Dynamic-Cache')); - // Assert that Dynamic Page Cache did not store a ResourceResponse object, - // which needs serialization after every cache hit. Instead, it should - // contain a flattened response. Otherwise performance suffers. - // @see \Drupal\rest\EventSubscriber\ResourceResponseSubscriber::flattenResponse() - $cache_items = $this->container->get('database') - ->query("SELECT cid, data FROM {cache_dynamic_page_cache} WHERE cid LIKE :pattern", [ - ':pattern' => '%[route]=rest.%', - ]) - ->fetchAllAssoc('cid'); - $this->assertCount(2, $cache_items); - $found_cache_redirect = FALSE; - $found_cached_response = FALSE; - foreach ($cache_items as $cid => $cache_item) { - $cached_data = unserialize($cache_item->data); - if (!isset($cached_data['#cache_redirect'])) { - $found_cached_response = TRUE; - $cached_response = $cached_data['#response']; - $this->assertNotInstanceOf(ResourceResponseInterface::class, $cached_response); - $this->assertInstanceOf(CacheableResponseInterface::class, $cached_response); - } - else { - $found_cache_redirect = TRUE; + // @todo Entity resources with URLs that begin with '/admin/' are marked as + // administrative (see https://www.drupal.org/node/2874938), which + // excludes them from Dynamic Page Cache (see + // https://www.drupal.org/node/2877528). When either of those issues is + // fixed, remove the if-test and the 'else' block. + if (strpos($this->entity->getEntityType()->getLinkTemplate('canonical'), '/admin/') !== 0) { + $this->assertTrue($response->hasHeader('X-Drupal-Dynamic-Cache')); + if (!static::$auth) { + $this->assertSame(['HIT'], $response->getHeader('X-Drupal-Cache')); + $this->assertSame(['MISS'], $response->getHeader('X-Drupal-Dynamic-Cache')); + } + else { + $this->assertFalse($response->hasHeader('X-Drupal-Cache')); + $this->assertSame(['HIT'], $response->getHeader('X-Drupal-Dynamic-Cache')); + // Assert that Dynamic Page Cache did not store a ResourceResponse object, + // which needs serialization after every cache hit. Instead, it should + // contain a flattened response. Otherwise performance suffers. + // @see \Drupal\rest\EventSubscriber\ResourceResponseSubscriber::flattenResponse() + $cache_items = $this->container->get('database') + ->query("SELECT cid, data FROM {cache_dynamic_page_cache} WHERE cid LIKE :pattern", [ + ':pattern' => '%[route]=rest.%', + ]) + ->fetchAllAssoc('cid'); + $this->assertCount(2, $cache_items); + $found_cache_redirect = FALSE; + $found_cached_response = FALSE; + foreach ($cache_items as $cid => $cache_item) { + $cached_data = unserialize($cache_item->data); + if (!isset($cached_data['#cache_redirect'])) { + $found_cached_response = TRUE; + $cached_response = $cached_data['#response']; + $this->assertNotInstanceOf(ResourceResponseInterface::class, $cached_response); + $this->assertInstanceOf(CacheableResponseInterface::class, $cached_response); + } + else { + $found_cache_redirect = TRUE; + } } + $this->assertTrue($found_cache_redirect); + $this->assertTrue($found_cached_response); } - $this->assertTrue($found_cache_redirect); - $this->assertTrue($found_cached_response); + } + else { + $this->assertFalse($response->hasHeader('X-Drupal-Dynamic-Cache')); } $cache_tags_header_value = $response->getHeader('X-Drupal-Cache-Tags')[0]; $this->assertEquals($this->getExpectedCacheTags(), empty($cache_tags_header_value) ? [] : explode(' ', $cache_tags_header_value)); diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityTest/EntityTestJsonInternalPropertyNormalizerTest.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityTest/EntityTestJsonInternalPropertyNormalizerTest.php index 1944718cf7..c369e17050 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityTest/EntityTestJsonInternalPropertyNormalizerTest.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityTest/EntityTestJsonInternalPropertyNormalizerTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\rest\Functional\EntityResource\EntityTest; -use Drupal\Core\Cache\Cache; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\Tests\rest\Functional\AnonResourceTestTrait; @@ -85,18 +84,4 @@ protected function getNormalizedPostEntity() { ]; } - /** - * {@inheritdoc} - */ - protected function getExpectedCacheContexts() { - return Cache::mergeContexts(parent::getExpectedCacheContexts(), ['request_format']); - } - - /** - * {@inheritdoc} - */ - protected function getExpectedCacheTags() { - return Cache::mergeTags(parent::getExpectedCacheTags(), ['you_are_it', 'no_tag_backs']); - } - } diff --git a/core/modules/search/migrations/d6_search_settings.yml b/core/modules/search/migration_templates/d6_search_settings.yml similarity index 100% rename from core/modules/search/migrations/d6_search_settings.yml rename to core/modules/search/migration_templates/d6_search_settings.yml diff --git a/core/modules/search/migrations/d7_search_settings.yml b/core/modules/search/migration_templates/d7_search_settings.yml similarity index 100% rename from core/modules/search/migrations/d7_search_settings.yml rename to core/modules/search/migration_templates/d7_search_settings.yml diff --git a/core/modules/search/migrations/search_page.yml b/core/modules/search/migration_templates/search_page.yml similarity index 100% rename from core/modules/search/migrations/search_page.yml rename to core/modules/search/migration_templates/search_page.yml diff --git a/core/modules/serialization/src/Encoder/JsonEncoder.php b/core/modules/serialization/src/Encoder/JsonEncoder.php index 964c2951f6..ad085ac00a 100644 --- a/core/modules/serialization/src/Encoder/JsonEncoder.php +++ b/core/modules/serialization/src/Encoder/JsonEncoder.php @@ -10,10 +10,6 @@ /** * Adds 'ajax to the supported content types of the JSON encoder' - * - * @internal - * This encoder should not be used directly. Rather, use the `serializer` - * service. */ class JsonEncoder extends BaseJsonEncoder implements EncoderInterface, DecoderInterface { diff --git a/core/modules/serialization/src/Encoder/XmlEncoder.php b/core/modules/serialization/src/Encoder/XmlEncoder.php index 53177b06cb..9db6ecde01 100644 --- a/core/modules/serialization/src/Encoder/XmlEncoder.php +++ b/core/modules/serialization/src/Encoder/XmlEncoder.php @@ -12,10 +12,6 @@ * * This acts as a wrapper class for Symfony's XmlEncoder so that it is not * implementing NormalizationAwareInterface, and can be normalized externally. - * - * @internal - * This encoder should not be used directly. Rather, use the `serializer` - * service. */ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, DecoderInterface { diff --git a/core/modules/serialization/src/Normalizer/NormalizerBase.php b/core/modules/serialization/src/Normalizer/NormalizerBase.php index 958aaf2f4c..5e829f65e7 100644 --- a/core/modules/serialization/src/Normalizer/NormalizerBase.php +++ b/core/modules/serialization/src/Normalizer/NormalizerBase.php @@ -2,8 +2,6 @@ namespace Drupal\serialization\Normalizer; -use Drupal\Core\Cache\CacheableDependencyInterface; -use Drupal\rest\EventSubscriber\ResourceResponseSubscriber; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer; @@ -83,18 +81,4 @@ protected function checkFormat($format = NULL) { return in_array($format, (array) $this->format, TRUE); } - /** - * Adds cacheability if applicable. - * - * @param array $context - * Context options for the normalizer. - * @param $data - * The data that might have cacheability information. - */ - protected function addCacheableDependency(array $context, $data) { - if ($data instanceof CacheableDependencyInterface && isset($context[ResourceResponseSubscriber::SERIALIZATION_CONTEXT_CACHEABILITY])) { - $context[ResourceResponseSubscriber::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($data); - } - } - } diff --git a/core/modules/serialization/src/Normalizer/TypedDataNormalizer.php b/core/modules/serialization/src/Normalizer/TypedDataNormalizer.php index 958b987dc7..60ce7d08f6 100644 --- a/core/modules/serialization/src/Normalizer/TypedDataNormalizer.php +++ b/core/modules/serialization/src/Normalizer/TypedDataNormalizer.php @@ -18,7 +18,6 @@ class TypedDataNormalizer extends NormalizerBase { * {@inheritdoc} */ public function normalize($object, $format = NULL, array $context = []) { - $this->addCacheableDependency($context, $object); return $object->getValue(); } diff --git a/core/modules/shortcut/migrations/d7_shortcut.yml b/core/modules/shortcut/migration_templates/d7_shortcut.yml similarity index 100% rename from core/modules/shortcut/migrations/d7_shortcut.yml rename to core/modules/shortcut/migration_templates/d7_shortcut.yml diff --git a/core/modules/shortcut/migrations/d7_shortcut_set.yml b/core/modules/shortcut/migration_templates/d7_shortcut_set.yml similarity index 100% rename from core/modules/shortcut/migrations/d7_shortcut_set.yml rename to core/modules/shortcut/migration_templates/d7_shortcut_set.yml diff --git a/core/modules/shortcut/migrations/d7_shortcut_set_users.yml b/core/modules/shortcut/migration_templates/d7_shortcut_set_users.yml similarity index 100% rename from core/modules/shortcut/migrations/d7_shortcut_set_users.yml rename to core/modules/shortcut/migration_templates/d7_shortcut_set_users.yml diff --git a/core/modules/simpletest/migrations/d6_simpletest_settings.yml b/core/modules/simpletest/migration_templates/d6_simpletest_settings.yml similarity index 100% rename from core/modules/simpletest/migrations/d6_simpletest_settings.yml rename to core/modules/simpletest/migration_templates/d6_simpletest_settings.yml diff --git a/core/modules/simpletest/migrations/d7_simpletest_settings.yml b/core/modules/simpletest/migration_templates/d7_simpletest_settings.yml similarity index 100% rename from core/modules/simpletest/migrations/d7_simpletest_settings.yml rename to core/modules/simpletest/migration_templates/d7_simpletest_settings.yml diff --git a/core/modules/statistics/migrations/statistics_settings.yml b/core/modules/statistics/migration_templates/statistics_settings.yml similarity index 100% rename from core/modules/statistics/migrations/statistics_settings.yml rename to core/modules/statistics/migration_templates/statistics_settings.yml diff --git a/core/modules/syslog/migrations/d6_syslog_settings.yml b/core/modules/syslog/migration_templates/d6_syslog_settings.yml similarity index 100% rename from core/modules/syslog/migrations/d6_syslog_settings.yml rename to core/modules/syslog/migration_templates/d6_syslog_settings.yml diff --git a/core/modules/syslog/migrations/d7_syslog_settings.yml b/core/modules/syslog/migration_templates/d7_syslog_settings.yml similarity index 100% rename from core/modules/syslog/migrations/d7_syslog_settings.yml rename to core/modules/syslog/migration_templates/d7_syslog_settings.yml diff --git a/core/modules/system/migrations/d6_date_formats.yml b/core/modules/system/migration_templates/d6_date_formats.yml similarity index 100% rename from core/modules/system/migrations/d6_date_formats.yml rename to core/modules/system/migration_templates/d6_date_formats.yml diff --git a/core/modules/system/migrations/d6_menu.yml b/core/modules/system/migration_templates/d6_menu.yml similarity index 100% rename from core/modules/system/migrations/d6_menu.yml rename to core/modules/system/migration_templates/d6_menu.yml diff --git a/core/modules/system/migrations/d6_system_cron.yml b/core/modules/system/migration_templates/d6_system_cron.yml similarity index 100% rename from core/modules/system/migrations/d6_system_cron.yml rename to core/modules/system/migration_templates/d6_system_cron.yml diff --git a/core/modules/system/migrations/d6_system_date.yml b/core/modules/system/migration_templates/d6_system_date.yml similarity index 100% rename from core/modules/system/migrations/d6_system_date.yml rename to core/modules/system/migration_templates/d6_system_date.yml diff --git a/core/modules/system/migrations/d6_system_file.yml b/core/modules/system/migration_templates/d6_system_file.yml similarity index 100% rename from core/modules/system/migrations/d6_system_file.yml rename to core/modules/system/migration_templates/d6_system_file.yml diff --git a/core/modules/system/migrations/d6_system_performance.yml b/core/modules/system/migration_templates/d6_system_performance.yml similarity index 100% rename from core/modules/system/migrations/d6_system_performance.yml rename to core/modules/system/migration_templates/d6_system_performance.yml diff --git a/core/modules/system/migrations/d7_global_theme_settings.yml b/core/modules/system/migration_templates/d7_global_theme_settings.yml similarity index 100% rename from core/modules/system/migrations/d7_global_theme_settings.yml rename to core/modules/system/migration_templates/d7_global_theme_settings.yml diff --git a/core/modules/system/migrations/d7_menu.yml b/core/modules/system/migration_templates/d7_menu.yml similarity index 100% rename from core/modules/system/migrations/d7_menu.yml rename to core/modules/system/migration_templates/d7_menu.yml diff --git a/core/modules/system/migrations/d7_system_authorize.yml b/core/modules/system/migration_templates/d7_system_authorize.yml similarity index 100% rename from core/modules/system/migrations/d7_system_authorize.yml rename to core/modules/system/migration_templates/d7_system_authorize.yml diff --git a/core/modules/system/migrations/d7_system_cron.yml b/core/modules/system/migration_templates/d7_system_cron.yml similarity index 100% rename from core/modules/system/migrations/d7_system_cron.yml rename to core/modules/system/migration_templates/d7_system_cron.yml diff --git a/core/modules/system/migrations/d7_system_date.yml b/core/modules/system/migration_templates/d7_system_date.yml similarity index 100% rename from core/modules/system/migrations/d7_system_date.yml rename to core/modules/system/migration_templates/d7_system_date.yml diff --git a/core/modules/system/migrations/d7_system_file.yml b/core/modules/system/migration_templates/d7_system_file.yml similarity index 100% rename from core/modules/system/migrations/d7_system_file.yml rename to core/modules/system/migration_templates/d7_system_file.yml diff --git a/core/modules/system/migrations/d7_system_mail.yml b/core/modules/system/migration_templates/d7_system_mail.yml similarity index 100% rename from core/modules/system/migrations/d7_system_mail.yml rename to core/modules/system/migration_templates/d7_system_mail.yml diff --git a/core/modules/system/migrations/d7_system_performance.yml b/core/modules/system/migration_templates/d7_system_performance.yml similarity index 100% rename from core/modules/system/migrations/d7_system_performance.yml rename to core/modules/system/migration_templates/d7_system_performance.yml diff --git a/core/modules/system/migrations/d7_theme_settings.yml b/core/modules/system/migration_templates/d7_theme_settings.yml similarity index 100% rename from core/modules/system/migrations/d7_theme_settings.yml rename to core/modules/system/migration_templates/d7_theme_settings.yml diff --git a/core/modules/system/migrations/system_image.yml b/core/modules/system/migration_templates/system_image.yml similarity index 100% rename from core/modules/system/migrations/system_image.yml rename to core/modules/system/migration_templates/system_image.yml diff --git a/core/modules/system/migrations/system_image_gd.yml b/core/modules/system/migration_templates/system_image_gd.yml similarity index 100% rename from core/modules/system/migrations/system_image_gd.yml rename to core/modules/system/migration_templates/system_image_gd.yml diff --git a/core/modules/system/migrations/system_logging.yml b/core/modules/system/migration_templates/system_logging.yml similarity index 100% rename from core/modules/system/migrations/system_logging.yml rename to core/modules/system/migration_templates/system_logging.yml diff --git a/core/modules/system/migrations/system_maintenance.yml b/core/modules/system/migration_templates/system_maintenance.yml similarity index 100% rename from core/modules/system/migrations/system_maintenance.yml rename to core/modules/system/migration_templates/system_maintenance.yml diff --git a/core/modules/system/migrations/system_rss.yml b/core/modules/system/migration_templates/system_rss.yml similarity index 100% rename from core/modules/system/migrations/system_rss.yml rename to core/modules/system/migration_templates/system_rss.yml diff --git a/core/modules/system/migrations/system_site.yml b/core/modules/system/migration_templates/system_site.yml similarity index 100% rename from core/modules/system/migrations/system_site.yml rename to core/modules/system/migration_templates/system_site.yml diff --git a/core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php b/core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php index 50b3a57808..b83fe7e130 100644 --- a/core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php +++ b/core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php @@ -4,11 +4,10 @@ use Drupal\Core\Routing\RouteSubscriberBase; use Drupal\Core\Routing\RoutingEvents; -use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; /** - * Adds the _admin_route option to each admin HTML route. + * Adds the _admin_route option to each admin route. */ class AdminRouteSubscriber extends RouteSubscriberBase { @@ -17,7 +16,7 @@ class AdminRouteSubscriber extends RouteSubscriberBase { */ protected function alterRoutes(RouteCollection $collection) { foreach ($collection->all() as $route) { - if (strpos($route->getPath(), '/admin') === 0 && !$route->hasOption('_admin_route') && static::isHtmlRoute($route)) { + if (strpos($route->getPath(), '/admin') === 0 && !$route->hasOption('_admin_route')) { $route->setOption('_admin_route', TRUE); } } @@ -37,19 +36,4 @@ public static function getSubscribedEvents() { return $events; } - /** - * Determines whether the given route is a HTML route. - * - * @param \Symfony\Component\Routing\Route $route - * The route to analyze. - * - * @return bool - * TRUE if HTML is a valid format for this route. - */ - protected static function isHtmlRoute(Route $route) { - // If a route has no explicit format, then HTML is valid. - $format = $route->hasRequirement('_format') ? explode('|', $route->getRequirement('_format')) : ['html']; - return in_array('html', $format, TRUE); - } - } diff --git a/core/modules/system/system.permissions.yml b/core/modules/system/system.permissions.yml index c2e668ac80..726c295ffa 100644 --- a/core/modules/system/system.permissions.yml +++ b/core/modules/system/system.permissions.yml @@ -15,10 +15,6 @@ access site in maintenance mode: view the administration theme: title: 'View the administration theme' description: 'This is only used when the site is configured to use a separate administration theme on the Appearance page.' -# Note that the 'access content' permission is moved to the Node section of the -# permission form when the Node module is enabled. -access content: - title: 'View published content' access site reports: title: 'View site reports' restrict access: true diff --git a/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php b/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php index a8175263b3..121699c807 100644 --- a/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php +++ b/core/modules/system/tests/modules/entity_test/src/TypedData/ComputedString.php @@ -2,14 +2,12 @@ namespace Drupal\entity_test\TypedData; -use Drupal\Core\Cache\Cache; -use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\TypedData\TypedData; /** * A computed property for test strings. */ -class ComputedString extends TypedData implements CacheableDependencyInterface { +class ComputedString extends TypedData { /** * {@inheritdoc} @@ -29,25 +27,4 @@ public function getCastedValue() { return $this->getString(); } - /** - * {@inheritdoc} - */ - public function getCacheTags() { - return ['you_are_it', 'no_tag_backs']; - } - - /** - * {@inheritdoc} - */ - public function getCacheContexts() { - return ['request_format']; - } - - /** - * {@inheritdoc} - */ - public function getCacheMaxAge() { - return Cache::PERMANENT; - } - } diff --git a/core/modules/system/tests/modules/module_cachebin/module_cachebin.info.yml b/core/modules/system/tests/modules/module_cachebin/module_cachebin.info.yml deleted file mode 100644 index d255795c52..0000000000 --- a/core/modules/system/tests/modules/module_cachebin/module_cachebin.info.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: module cache bin tests -type: module -description: Test cache bins defined by modules. -package: Testing -version: VERSION -core: 8.x -hidden: true diff --git a/core/modules/system/tests/modules/module_cachebin/module_cachebin.services.yml b/core/modules/system/tests/modules/module_cachebin/module_cachebin.services.yml deleted file mode 100644 index 8e1427463b..0000000000 --- a/core/modules/system/tests/modules/module_cachebin/module_cachebin.services.yml +++ /dev/null @@ -1,7 +0,0 @@ -services: - module_cachebin.cache_bin: - class: Drupal\Core\Cache\CacheBackendInterface - tags: - - { name: cache.bin } - factory: cache.backend.database:get - arguments: [module_cachebin] diff --git a/core/modules/system/tests/src/Kernel/PermissionsTest.php b/core/modules/system/tests/src/Kernel/PermissionsTest.php deleted file mode 100644 index fdd69f52f5..0000000000 --- a/core/modules/system/tests/src/Kernel/PermissionsTest.php +++ /dev/null @@ -1,44 +0,0 @@ -installSchema('user', ['users_data']); - - $permissions = $this->container->get('user.permissions')->getPermissions(); - $this->assertSame('system', $permissions['access content']['provider']); - - // Install the 'node' module, assert that it is now the 'node' module - // providing the 'access content' permission. - $this->container->get('module_installer')->install(['node']); - - $permissions = $this->container->get('user.permissions')->getPermissions(); - $this->assertSame('system', $permissions['access content']['provider']); - - // Uninstall the 'node' module, assert that it is again the 'system' module. - $this->container->get('module_installer')->uninstall(['node']); - - $permissions = $this->container->get('user.permissions')->getPermissions(); - $this->assertSame('system', $permissions['access content']['provider']); - } - -} diff --git a/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php b/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php deleted file mode 100644 index 153391c419..0000000000 --- a/core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php +++ /dev/null @@ -1,70 +0,0 @@ -add('the_route', $route); - (new AdminRouteSubscriber())->onAlterRoutes(new RouteBuildEvent($collection)); - - $this->assertSame($is_admin, $route->getOption('_admin_route')); - } - - public function providerTestAlterRoutes() { - $data = []; - $data['non-admin'] = [ - new Route('/foo'), - NULL, - ]; - $data['admin prefix'] = [ - new Route('/admin/foo'), - TRUE, - ]; - $data['admin option'] = [ - (new Route('/foo')) - ->setOption('_admin_route', TRUE), - TRUE, - ]; - $data['admin prefix, non-HTML format'] = [ - (new Route('/admin/foo')) - ->setRequirement('_format', 'json'), - NULL, - ]; - $data['admin option, non-HTML format'] = [ - (new Route('/foo')) - ->setRequirement('_format', 'json') - ->setOption('_admin_route', TRUE), - TRUE, - ]; - $data['admin prefix, HTML format'] = [ - (new Route('/admin/foo')) - ->setRequirement('_format', 'html'), - TRUE, - ]; - $data['admin prefix, multi-format including HTML'] = [ - (new Route('/admin/foo')) - ->setRequirement('_format', 'json|html'), - TRUE, - ]; - return $data; - } - -} diff --git a/core/modules/taxonomy/migrations/d6_taxonomy_term.yml b/core/modules/taxonomy/migration_templates/d6_taxonomy_term.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_taxonomy_term.yml rename to core/modules/taxonomy/migration_templates/d6_taxonomy_term.yml diff --git a/core/modules/taxonomy/migrations/d6_taxonomy_term_translation.yml b/core/modules/taxonomy/migration_templates/d6_taxonomy_term_translation.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_taxonomy_term_translation.yml rename to core/modules/taxonomy/migration_templates/d6_taxonomy_term_translation.yml diff --git a/core/modules/taxonomy/migrations/d6_taxonomy_vocabulary.yml b/core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_taxonomy_vocabulary.yml rename to core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary.yml diff --git a/core/modules/taxonomy/migrations/d6_taxonomy_vocabulary_translation.yml b/core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary_translation.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_taxonomy_vocabulary_translation.yml rename to core/modules/taxonomy/migration_templates/d6_taxonomy_vocabulary_translation.yml diff --git a/core/modules/taxonomy/migrations/d6_term_node.yml b/core/modules/taxonomy/migration_templates/d6_term_node.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_term_node.yml rename to core/modules/taxonomy/migration_templates/d6_term_node.yml diff --git a/core/modules/taxonomy/migrations/d6_term_node_revision.yml b/core/modules/taxonomy/migration_templates/d6_term_node_revision.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_term_node_revision.yml rename to core/modules/taxonomy/migration_templates/d6_term_node_revision.yml diff --git a/core/modules/taxonomy/migrations/d6_vocabulary_entity_display.yml b/core/modules/taxonomy/migration_templates/d6_vocabulary_entity_display.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_vocabulary_entity_display.yml rename to core/modules/taxonomy/migration_templates/d6_vocabulary_entity_display.yml diff --git a/core/modules/taxonomy/migrations/d6_vocabulary_entity_form_display.yml b/core/modules/taxonomy/migration_templates/d6_vocabulary_entity_form_display.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_vocabulary_entity_form_display.yml rename to core/modules/taxonomy/migration_templates/d6_vocabulary_entity_form_display.yml diff --git a/core/modules/taxonomy/migrations/d6_vocabulary_field.yml b/core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_vocabulary_field.yml rename to core/modules/taxonomy/migration_templates/d6_vocabulary_field.yml diff --git a/core/modules/taxonomy/migrations/d6_vocabulary_field_instance.yml b/core/modules/taxonomy/migration_templates/d6_vocabulary_field_instance.yml similarity index 100% rename from core/modules/taxonomy/migrations/d6_vocabulary_field_instance.yml rename to core/modules/taxonomy/migration_templates/d6_vocabulary_field_instance.yml diff --git a/core/modules/taxonomy/migrations/d7_taxonomy_term.yml b/core/modules/taxonomy/migration_templates/d7_taxonomy_term.yml similarity index 100% rename from core/modules/taxonomy/migrations/d7_taxonomy_term.yml rename to core/modules/taxonomy/migration_templates/d7_taxonomy_term.yml diff --git a/core/modules/taxonomy/migrations/d7_taxonomy_vocabulary.yml b/core/modules/taxonomy/migration_templates/d7_taxonomy_vocabulary.yml similarity index 100% rename from core/modules/taxonomy/migrations/d7_taxonomy_vocabulary.yml rename to core/modules/taxonomy/migration_templates/d7_taxonomy_vocabulary.yml diff --git a/core/modules/taxonomy/migrations/taxonomy_settings.yml b/core/modules/taxonomy/migration_templates/taxonomy_settings.yml similarity index 100% rename from core/modules/taxonomy/migrations/taxonomy_settings.yml rename to core/modules/taxonomy/migration_templates/taxonomy_settings.yml diff --git a/core/modules/text/migrations/text_settings.yml b/core/modules/text/migration_templates/text_settings.yml similarity index 100% rename from core/modules/text/migrations/text_settings.yml rename to core/modules/text/migration_templates/text_settings.yml diff --git a/core/modules/tracker/migrations/d7_tracker_node.yml b/core/modules/tracker/migration_templates/d7_tracker_node.yml similarity index 100% rename from core/modules/tracker/migrations/d7_tracker_node.yml rename to core/modules/tracker/migration_templates/d7_tracker_node.yml diff --git a/core/modules/tracker/migrations/d7_tracker_settings.yml b/core/modules/tracker/migration_templates/d7_tracker_settings.yml similarity index 100% rename from core/modules/tracker/migrations/d7_tracker_settings.yml rename to core/modules/tracker/migration_templates/d7_tracker_settings.yml diff --git a/core/modules/tracker/migrations/d7_tracker_user.yml b/core/modules/tracker/migration_templates/d7_tracker_user.yml similarity index 100% rename from core/modules/tracker/migrations/d7_tracker_user.yml rename to core/modules/tracker/migration_templates/d7_tracker_user.yml diff --git a/core/modules/update/migrations/update_settings.yml b/core/modules/update/migration_templates/update_settings.yml similarity index 100% rename from core/modules/update/migrations/update_settings.yml rename to core/modules/update/migration_templates/update_settings.yml diff --git a/core/modules/user/migrations/d6_profile_values.yml b/core/modules/user/migration_templates/d6_profile_values.yml similarity index 100% rename from core/modules/user/migrations/d6_profile_values.yml rename to core/modules/user/migration_templates/d6_profile_values.yml diff --git a/core/modules/user/migrations/d6_user.yml b/core/modules/user/migration_templates/d6_user.yml similarity index 100% rename from core/modules/user/migrations/d6_user.yml rename to core/modules/user/migration_templates/d6_user.yml diff --git a/core/modules/user/migrations/d6_user_contact_settings.yml b/core/modules/user/migration_templates/d6_user_contact_settings.yml similarity index 100% rename from core/modules/user/migrations/d6_user_contact_settings.yml rename to core/modules/user/migration_templates/d6_user_contact_settings.yml diff --git a/core/modules/user/migrations/d6_user_mail.yml b/core/modules/user/migration_templates/d6_user_mail.yml similarity index 100% rename from core/modules/user/migrations/d6_user_mail.yml rename to core/modules/user/migration_templates/d6_user_mail.yml diff --git a/core/modules/user/migrations/d6_user_picture_file.yml b/core/modules/user/migration_templates/d6_user_picture_file.yml similarity index 100% rename from core/modules/user/migrations/d6_user_picture_file.yml rename to core/modules/user/migration_templates/d6_user_picture_file.yml diff --git a/core/modules/user/migrations/d6_user_role.yml b/core/modules/user/migration_templates/d6_user_role.yml similarity index 100% rename from core/modules/user/migrations/d6_user_role.yml rename to core/modules/user/migration_templates/d6_user_role.yml diff --git a/core/modules/user/migrations/d6_user_settings.yml b/core/modules/user/migration_templates/d6_user_settings.yml similarity index 100% rename from core/modules/user/migrations/d6_user_settings.yml rename to core/modules/user/migration_templates/d6_user_settings.yml diff --git a/core/modules/user/migrations/d7_user.yml b/core/modules/user/migration_templates/d7_user.yml similarity index 100% rename from core/modules/user/migrations/d7_user.yml rename to core/modules/user/migration_templates/d7_user.yml diff --git a/core/modules/user/migrations/d7_user_flood.yml b/core/modules/user/migration_templates/d7_user_flood.yml similarity index 100% rename from core/modules/user/migrations/d7_user_flood.yml rename to core/modules/user/migration_templates/d7_user_flood.yml diff --git a/core/modules/user/migrations/d7_user_mail.yml b/core/modules/user/migration_templates/d7_user_mail.yml similarity index 100% rename from core/modules/user/migrations/d7_user_mail.yml rename to core/modules/user/migration_templates/d7_user_mail.yml diff --git a/core/modules/user/migrations/d7_user_role.yml b/core/modules/user/migration_templates/d7_user_role.yml similarity index 100% rename from core/modules/user/migrations/d7_user_role.yml rename to core/modules/user/migration_templates/d7_user_role.yml diff --git a/core/modules/user/migrations/user_picture_entity_display.yml b/core/modules/user/migration_templates/user_picture_entity_display.yml similarity index 100% rename from core/modules/user/migrations/user_picture_entity_display.yml rename to core/modules/user/migration_templates/user_picture_entity_display.yml diff --git a/core/modules/user/migrations/user_picture_entity_form_display.yml b/core/modules/user/migration_templates/user_picture_entity_form_display.yml similarity index 100% rename from core/modules/user/migrations/user_picture_entity_form_display.yml rename to core/modules/user/migration_templates/user_picture_entity_form_display.yml diff --git a/core/modules/user/migrations/user_picture_field.yml b/core/modules/user/migration_templates/user_picture_field.yml similarity index 100% rename from core/modules/user/migrations/user_picture_field.yml rename to core/modules/user/migration_templates/user_picture_field.yml diff --git a/core/modules/user/migrations/user_picture_field_instance.yml b/core/modules/user/migration_templates/user_picture_field_instance.yml similarity index 100% rename from core/modules/user/migrations/user_picture_field_instance.yml rename to core/modules/user/migration_templates/user_picture_field_instance.yml diff --git a/core/modules/user/migrations/user_profile_entity_display.yml b/core/modules/user/migration_templates/user_profile_entity_display.yml similarity index 100% rename from core/modules/user/migrations/user_profile_entity_display.yml rename to core/modules/user/migration_templates/user_profile_entity_display.yml diff --git a/core/modules/user/migrations/user_profile_entity_form_display.yml b/core/modules/user/migration_templates/user_profile_entity_form_display.yml similarity index 100% rename from core/modules/user/migrations/user_profile_entity_form_display.yml rename to core/modules/user/migration_templates/user_profile_entity_form_display.yml diff --git a/core/modules/user/migrations/user_profile_field.yml b/core/modules/user/migration_templates/user_profile_field.yml similarity index 100% rename from core/modules/user/migrations/user_profile_field.yml rename to core/modules/user/migration_templates/user_profile_field.yml diff --git a/core/modules/user/migrations/user_profile_field_instance.yml b/core/modules/user/migration_templates/user_profile_field_instance.yml similarity index 100% rename from core/modules/user/migrations/user_profile_field_instance.yml rename to core/modules/user/migration_templates/user_profile_field_instance.yml diff --git a/core/modules/user/src/Form/UserPermissionsForm.php b/core/modules/user/src/Form/UserPermissionsForm.php index 7d3adaa5dc..daa879ab31 100644 --- a/core/modules/user/src/Form/UserPermissionsForm.php +++ b/core/modules/user/src/Form/UserPermissionsForm.php @@ -129,21 +129,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { $permissions_by_provider[$permission['provider']][$permission_name] = $permission; } - // Move the access content permission to the Node module if it is installed. - if ($this->moduleHandler->moduleExists('node')) { - // Insert 'access content' before the 'view own unpublished content' key - // in order to maintain the UI even though the permission is provided by - // the system module. - $keys = array_keys($permissions_by_provider['node']); - $offset = (int) array_search('view own unpublished content', $keys); - $permissions_by_provider['node'] = array_merge( - array_slice($permissions_by_provider['node'], 0, $offset), - ['access content' => $permissions_by_provider['system']['access content']], - array_slice($permissions_by_provider['node'], $offset) - ); - unset($permissions_by_provider['system']['access content']); - } - foreach ($permissions_by_provider as $provider => $permissions) { // Module name. $form['permissions'][$provider] = [ diff --git a/core/modules/user/src/Tests/UserPermissionsTest.php b/core/modules/user/src/Tests/UserPermissionsTest.php index 51fdebe94d..4f9e260abc 100644 --- a/core/modules/user/src/Tests/UserPermissionsTest.php +++ b/core/modules/user/src/Tests/UserPermissionsTest.php @@ -164,24 +164,4 @@ public function testUserRoleChangePermissions() { $this->assertNotEqual($previous_permissions_hash, $current_permissions_hash, 'Permissions hash has changed.'); } - /** - * Verify 'access content' is listed in the correct location. - */ - public function testAccessContentPermission() { - $this->drupalLogin($this->adminUser); - - // When Node is not installed the 'access content' permission is listed next - // to 'access site reports'. - $this->drupalGet('admin/people/permissions'); - $next_row = $this->xpath('//tr[@data-drupal-selector=\'edit-permissions-access-content\']/following-sibling::tr[1]'); - $this->assertEqual('edit-permissions-access-site-reports', $next_row[0]->attributes()['data-drupal-selector']); - - // When Node is installed the 'access content' permission is listed next to - // to 'view own unpublished content'. - \Drupal::service('module_installer')->install(['node']); - $this->drupalGet('admin/people/permissions'); - $next_row = $this->xpath('//tr[@data-drupal-selector=\'edit-permissions-access-content\']/following-sibling::tr[1]'); - $this->assertEqual('edit-permissions-view-own-unpublished-content', $next_row[0]->attributes()['data-drupal-selector']); - } - } diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php index ff183c6f00..fa5a9a1751 100644 --- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php @@ -60,29 +60,4 @@ public function testConfigChangeOnInstall() { $this->assertEquals(1, $modules['module_handler_test_multiple_child'], 'Weight of module_handler_test_multiple_child is set.'); } - /** - * Tests cache bins defined by modules are removed when uninstalled. - * - * @covers ::removeCacheBins - */ - public function testCacheBinCleanup() { - $schema = $this->container->get('database')->schema(); - $table = 'cache_module_cachebin'; - - $module_installer = $this->container->get('module_installer'); - $module_installer->install(['module_cachebin']); - - // Prime the bin. - /** @var \Drupal\Core\Cache\CacheBackendInterface $cache_bin */ - $cache_bin = $this->container->get('module_cachebin.cache_bin'); - $cache_bin->set('foo', 'bar'); - - // A database backend is used so there is a convenient way check whether the - // backend is uninstalled. - $this->assertTrue($schema->tableExists($table)); - - $module_installer->uninstall(['module_cachebin']); - $this->assertFalse($schema->tableExists($table)); - } - }