diff --cc core/modules/system/system.install index 6dc2663,79d97ce..0000000 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@@ -1775,22 -1775,28 +1775,55 @@@ function system_update_8201() */ /** + * Clear caches due to behavior change in MachineName element. + */ +function system_update_8202() { + // Empty update to cause a cache rebuild. +} + +/** - * @} End of "addtogroup updates-8.2.3". - */ - - /** + * Add detailed cron logging configuration. + */ +function system_update_8203() { + $config_factory = \Drupal::configFactory(); + $system_cron_config = $config_factory->getEditable('system.cron') + ->set('logging', 1) + ->save(TRUE); +} ++ ++/** ++ * @} End of "addtogroup updates-8.2.3". ++ */ ++ ++/** ++ * @addtogroup updates-8.3.0 ++ * @{ ++ */ ++ ++ /** + * Install new revision_uuid schema. + */ + function system_update_8300() { ++ $revision_uuid = BaseFieldDefinition::create('uuid') ++ ->setLabel(new TranslatableMarkup('Revision UUID')) ++ ->setRevisionable(TRUE) ++ ->setReadOnly(TRUE); + foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type_id => $entity_type) { + /** @var \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface $manager */ + $manager = \Drupal::entityDefinitionUpdateManager(); + + // Install the new revision_uuid field. + if ($entity_type->hasKey('revision_uuid')) { - $field_manager = \Drupal::service('entity_field.manager'); - $field_storage_definitions = $field_manager->getFieldStorageDefinitions($entity_type_id); - $manager->installFieldStorageDefinition($entity_type->getKey('revision_uuid'), $entity_type_id, $entity_type->getProvider(), $field_storage_definitions[$entity_type->getKey('revision_uuid')]); ++ $manager->installFieldStorageDefinition($entity_type->getKey('revision_uuid'), $entity_type_id, $entity_type->getProvider(), $revision_uuid); + } + + // Update the existing uuid field which has a new schema. + if ($entity_type->hasKey('uuid') && $definition = $manager->getFieldStorageDefinition('uuid', $entity_type_id)) { + $manager->updateFieldStorageDefinition($definition); + } + } + } + + /** + * @} End of "addtogroup updates-8.3.0". + */ - diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index fc581be..e267ebd 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -89,8 +89,7 @@ public function getOriginalClass(); * are unique across all entities of a type. If this entry is omitted * the entities of this type are not revisionable. * - revision_uuid: (optional) The name of the property that contains the - * revision UUID of the entity. Defaults to "revision_uuid" if the - * 'revision' key is set. + * revision UUID of the entity. * - bundle: (optional) The name of the property that contains the bundle * name for the entity. The bundle name defines which set of fields are * attached to the entity (e.g. what nodes call "content type"). This diff --git a/core/lib/Drupal/Core/Entity/RevisionUuidInterface.php b/core/lib/Drupal/Core/Entity/RevisionUuidInterface.php index ed20b42..3dcbcb8 100644 --- a/core/lib/Drupal/Core/Entity/RevisionUuidInterface.php +++ b/core/lib/Drupal/Core/Entity/RevisionUuidInterface.php @@ -8,7 +8,7 @@ interface RevisionUuidInterface { /** - * Gets the revision universally-unique identifier of the entity. + * Gets the revision universally-unique identifier of the entity revision. * * This identifier can be used when moving specific revisions between two * systems. The UUID of the entity itself is not unique enough for the diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php index d09c23a..8286391 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php @@ -298,11 +298,11 @@ public function getTableMapping(array $storage_definitions = NULL) { // log. // @todo Provide automatic definitions for revision metadata fields in // https://www.drupal.org/node/2248983. - $revision_metadata_fields = array_intersect([ + $revision_metadata_fields = array_intersect(array( 'revision_timestamp', 'revision_uid', 'revision_log', - ], $all_fields); + ), $all_fields); $revisionable = $this->entityType->isRevisionable(); $translatable = $this->entityType->isTranslatable(); diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 6ae9600..504ee92 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -176,6 +176,7 @@ public function requiresFieldStorageSchemaChanges(FieldStorageDefinitionInterfac if ( $storage_definition->hasCustomStorage() != $original->hasCustomStorage() || + $storage_definition->getSchema() != $original->getSchema() || $storage_definition->isRevisionable() != $original->isRevisionable() || $table_mapping->allowsSharedTableStorage($storage_definition) != $table_mapping->allowsSharedTableStorage($original) || $table_mapping->requiresDedicatedTableStorage($storage_definition) != $table_mapping->requiresDedicatedTableStorage($original) diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php index 0931f41..07e8287 100644 --- a/core/modules/comment/src/CommentStorage.php +++ b/core/modules/comment/src/CommentStorage.php @@ -47,8 +47,8 @@ class CommentStorage extends SqlContentEntityStorage implements CommentStorageIn * @param \Drupal\Component\Uuid\UuidInterface $uuid_service * The UUID service. */ - public function __construct(EntityTypeInterface $entity_info, Connection $database, EntityManagerInterface $entity_manager, AccountInterface $current_user, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, UuidInterface $uuid_service) { - parent::__construct($entity_info, $database, $entity_manager, $cache, $language_manager, $uuid_service); + public function __construct(EntityTypeInterface $entity_info, Connection $database, EntityManagerInterface $entity_manager, AccountInterface $current_user, CacheBackendInterface $cache, LanguageManagerInterface $language_manager) { + parent::__construct($entity_info, $database, $entity_manager, $cache, $language_manager); $this->currentUser = $current_user; } @@ -62,8 +62,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI $container->get('entity.manager'), $container->get('current_user'), $container->get('cache.entity'), - $container->get('language_manager'), - $container->get('uuid') + $container->get('language_manager') ); }