Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -15,7 +15,7 @@ use Drupal\field\Entity\FieldStorageConfig;
*/
function comment_uninstall() {
// Remove the comment fields.
$fields = entity_load_multiple_by_properties('field_storage_config', array('type' => 'comment'));
$fields = entity_load_multiple_by_properties('field_storage_config', ['type' => 'comment']);
foreach ($fields as $field) {
$field->delete();
}
@ -37,87 +37,82 @@ function comment_install() {
* Implements hook_schema().
*/
function comment_schema() {
$schema['comment_entity_statistics'] = array(
$schema['comment_entity_statistics'] = [
'description' => 'Maintains statistics of entity and comments posts to show "new" and "updated" flags.',
'fields' => array(
'entity_id' => array(
'fields' => [
'entity_id' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The entity_id of the entity for which the statistics are compiled.',
),
'entity_type' => array(
],
'entity_type' => [
'type' => 'varchar_ascii',
'not null' => TRUE,
'default' => 'node',
'length' => EntityTypeInterface::ID_MAX_LENGTH,
'description' => 'The entity_type of the entity to which this comment is a reply.',
),
'field_name' => array(
],
'field_name' => [
'type' => 'varchar_ascii',
'not null' => TRUE,
'default' => '',
'length' => FieldStorageConfig::NAME_MAX_LENGTH,
'description' => 'The field_name of the field that was used to add this comment.',
),
'cid' => array(
],
'cid' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The {comment}.cid of the last comment.',
),
'last_comment_timestamp' => array(
],
'last_comment_timestamp' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The Unix timestamp of the last comment that was posted within this node, from {comment}.changed.',
),
'last_comment_name' => array(
],
'last_comment_name' => [
'type' => 'varchar',
'length' => 60,
'not null' => FALSE,
'description' => 'The name of the latest author to post a comment on this node, from {comment}.name.',
),
'last_comment_uid' => array(
],
'last_comment_uid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The user ID of the latest author to post a comment on this node, from {comment}.uid.',
),
'comment_count' => array(
],
'comment_count' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The total number of comments on this entity.',
),
),
'primary key' => array('entity_id', 'entity_type', 'field_name'),
'indexes' => array(
'last_comment_timestamp' => array('last_comment_timestamp'),
'comment_count' => array('comment_count'),
'last_comment_uid' => array('last_comment_uid'),
),
'foreign keys' => array(
'last_comment_author' => array(
],
],
'primary key' => ['entity_id', 'entity_type', 'field_name'],
'indexes' => [
'last_comment_timestamp' => ['last_comment_timestamp'],
'comment_count' => ['comment_count'],
'last_comment_uid' => ['last_comment_uid'],
],
'foreign keys' => [
'last_comment_author' => [
'table' => 'users',
'columns' => array(
'columns' => [
'last_comment_uid' => 'uid',
),
),
),
);
],
],
],
];
return $schema;
}
/**
* @addtogroup updates-8.0.0-rc
* @{
*/
/**
* Clear caches to fix Comment entity list builder and operations Views field.
*/
@ -126,10 +121,6 @@ function comment_update_8001() {
// information, so that comment operation links work.
}
/**
* @} End of "addtogroup updates-8.0.0-rc".
*/
/**
* Clear caches to fix Comment Views context filter.
*/
@ -137,11 +128,6 @@ function comment_update_8002() {
// Empty update to cause a cache flush.
}
/**
* @addtogroup updates-8.2.x
* @{
*/
/**
* Add the 'view_mode' setting to displays having 'comment_default' formatter.
*/
@ -177,5 +163,24 @@ function comment_update_8200() {
}
/**
* @} End of "addtogroup updates-8.2.x".
* Update status field.
*/
function comment_update_8300() {
$entity_definition_update_manager = \Drupal::service('entity.definition_update_manager');
$field_definition = $entity_definition_update_manager->getFieldStorageDefinition('status', 'comment');
$field_definition->setDescription(new TranslatableMarkup('A boolean indicating the published state.'))
->setRevisionable(TRUE);
$entity_definition_update_manager->updateFieldStorageDefinition($field_definition);
}
/**
* Set the 'published' entity key.
*/
function comment_update_8301() {
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $definition_update_manager->getEntityType('comment');
$keys = $entity_type->getKeys();
$keys['published'] = 'status';
$entity_type->set('entity_keys', $keys);
$definition_update_manager->updateEntityType($entity_type);
}