You are here

message-digest-update-8101.php in Message Digest 8

Upgrade data for message_digest_update_8101().

Contains database additions to drupal-8.bare.standard.php.gz for testing the upgrade path of message_digest_update_8101().

File

tests/fixtures/update/message-digest-update-8101.php
View source
<?php

/**
 * @file
 * Upgrade data for message_digest_update_8101().
 *
 * Contains database additions to drupal-8.bare.standard.php.gz for testing the
 * upgrade path of message_digest_update_8101().
 */
use Drupal\Core\Database\Database;
$connection = Database::getConnection();

// Set the schema version.
$connection
  ->insert('key_value')
  ->fields([
  'collection' => 'system.schema',
  'name' => 'message_digest',
  'value' => 'i:8100;',
])
  ->execute();

// Update core.extension to enable message_digest.
$extensions = $connection
  ->select('config')
  ->fields('config', [
  'data',
])
  ->condition('collection', '')
  ->condition('name', 'core.extension')
  ->execute()
  ->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['message'] = 0;
$extensions['module']['message_digest'] = 0;
$extensions['module']['message_notify'] = 0;
$connection
  ->update('config')
  ->fields([
  'data' => serialize($extensions),
])
  ->condition('collection', '')
  ->condition('name', 'core.extension')
  ->execute();

// Install the message template entity type.
$connection
  ->merge('key_value')
  ->condition('collection', 'entity.definitions.installed')
  ->condition('name', 'message_template.entity_type')
  ->fields([
  'value' => 'O:42:"Drupal\\Core\\Config\\Entity\\ConfigEntityType":41:{s:16:"*config_prefix";s:8:"template";s:15:"*static_cache";b:0;s:14:"*lookup_keys";a:1:{i:0;s:4:"uuid";}s:16:"*config_export";a:7:{i:0;s:8:"template";i:1;s:5:"label";i:2;s:8:"langcode";i:3;s:11:"description";i:4;s:4:"text";i:5;s:8:"settings";i:6;s:6:"status";}s:21:"*mergedConfigExport";a:0:{}s:15:"*render_cache";b:1;s:19:"*persistent_cache";b:1;s:14:"*entity_keys";a:8:{s:2:"id";s:8:"template";s:5:"label";s:5:"label";s:8:"langcode";s:8:"langcode";s:8:"revision";s:0:"";s:6:"bundle";s:0:"";s:16:"default_langcode";s:16:"default_langcode";s:29:"revision_translation_affected";s:29:"revision_translation_affected";s:4:"uuid";s:4:"uuid";}s:5:"*id";s:16:"message_template";s:16:"*originalClass";s:37:"Drupal\\message\\Entity\\MessageTemplate";s:11:"*handlers";a:5:{s:4:"form";a:3:{s:3:"add";s:39:"Drupal\\message\\Form\\MessageTemplateForm";s:4:"edit";s:39:"Drupal\\message\\Form\\MessageTemplateForm";s:6:"delete";s:48:"Drupal\\message\\Form\\MessageTemplateDeleteConfirm";}s:12:"list_builder";s:41:"Drupal\\message\\MessageTemplateListBuilder";s:12:"view_builder";s:33:"Drupal\\message\\MessageViewBuilder";s:6:"access";s:45:"Drupal\\Core\\Entity\\EntityAccessControlHandler";s:7:"storage";s:45:"Drupal\\Core\\Config\\Entity\\ConfigEntityStorage";}s:19:"*admin_permission";s:28:"administer message templates";s:25:"*permission_granularity";s:11:"entity_type";s:8:"*links";a:3:{s:8:"add-form";s:37:"/admin/structure/message/template/add";s:9:"edit-form";s:50:"/admin/structure/message/manage/{message_template}";s:11:"delete-form";s:50:"/admin/structure/message/delete/{message_template}";}s:17:"*label_callback";N;s:21:"*bundle_entity_type";N;s:12:"*bundle_of";s:7:"message";s:15:"*bundle_label";N;s:13:"*base_table";N;s:22:"*revision_data_table";N;s:17:"*revision_table";N;s:13:"*data_table";N;s:15:"*translatable";b:0;s:19:"*show_revision_ui";b:0;s:8:"*label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:16:"Message template";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:19:"*label_collection";s:0:"";s:17:"*label_singular";s:0:"";s:15:"*label_plural";s:0:"";s:14:"*label_count";a:0:{}s:15:"*uri_callback";N;s:8:"*group";s:13:"configuration";s:14:"*group_label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:13:"Configuration";s:12:"*arguments";a:0:{}s:10:"*options";a:1:{s:7:"context";s:17:"Entity type group";}}s:22:"*field_ui_base_route";N;s:26:"*common_reference_target";b:0;s:22:"*list_cache_contexts";a:0:{}s:18:"*list_cache_tags";a:1:{i:0;s:28:"config:message_template_list";}s:14:"*constraints";a:0:{}s:13:"*additional";a:0:{}s:8:"*class";s:37:"Drupal\\message\\Entity\\MessageTemplate";s:11:"*provider";s:7:"message";s:20:"*stringTranslation";N;}',
  'name' => 'message_template.entity_type',
  'collection' => 'entity.definitions.installed',
])
  ->execute();

// Install the message entity type.
$connection
  ->merge('key_value')
  ->condition('collection', 'entity.definitions.installed')
  ->condition('name', 'message.entity_type')
  ->fields([
  'value' => 'O:36:"Drupal\\Core\\Entity\\ContentEntityType":38:{s:25:"*revision_metadata_keys";a:0:{}s:15:"*static_cache";b:1;s:15:"*render_cache";b:1;s:19:"*persistent_cache";b:1;s:14:"*entity_keys";a:8:{s:2:"id";s:3:"mid";s:6:"bundle";s:8:"template";s:4:"uuid";s:4:"uuid";s:8:"langcode";s:8:"langcode";s:3:"uid";s:3:"uid";s:8:"revision";s:0:"";s:16:"default_langcode";s:16:"default_langcode";s:29:"revision_translation_affected";s:29:"revision_translation_affected";}s:5:"*id";s:7:"message";s:16:"*originalClass";s:29:"Drupal\\message\\Entity\\Message";s:11:"*handlers";a:6:{s:12:"view_builder";s:33:"Drupal\\message\\MessageViewBuilder";s:12:"list_builder";s:33:"Drupal\\message\\MessageListBuilder";s:10:"views_data";s:31:"Drupal\\message\\MessageViewsData";s:4:"form";a:1:{s:7:"default";s:36:"Drupal\\Core\\Entity\\ContentEntityForm";}s:6:"access";s:45:"Drupal\\Core\\Entity\\EntityAccessControlHandler";s:7:"storage";s:46:"Drupal\\Core\\Entity\\Sql\\SqlContentEntityStorage";}s:19:"*admin_permission";N;s:25:"*permission_granularity";s:11:"entity_type";s:8:"*links";a:0:{}s:17:"*label_callback";N;s:21:"*bundle_entity_type";s:16:"message_template";s:12:"*bundle_of";N;s:15:"*bundle_label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:16:"Message template";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:13:"*base_table";s:7:"message";s:22:"*revision_data_table";N;s:17:"*revision_table";N;s:13:"*data_table";s:18:"message_field_data";s:15:"*translatable";b:1;s:19:"*show_revision_ui";b:0;s:8:"*label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:7:"Message";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:19:"*label_collection";s:0:"";s:17:"*label_singular";s:0:"";s:15:"*label_plural";s:0:"";s:14:"*label_count";a:0:{}s:15:"*uri_callback";N;s:8:"*group";s:7:"content";s:14:"*group_label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:7:"Content";s:12:"*arguments";a:0:{}s:10:"*options";a:1:{s:7:"context";s:17:"Entity type group";}}s:22:"*field_ui_base_route";s:33:"entity.message_template.edit_form";s:26:"*common_reference_target";b:0;s:22:"*list_cache_contexts";a:0:{}s:18:"*list_cache_tags";a:1:{i:0;s:12:"message_list";}s:14:"*constraints";a:0:{}s:13:"*additional";a:2:{s:6:"module";s:7:"message";s:11:"bundle_keys";a:1:{s:6:"bundle";s:8:"template";}}s:8:"*class";s:29:"Drupal\\message\\Entity\\Message";s:11:"*provider";s:7:"message";s:20:"*stringTranslation";N;}',
  'name' => 'message.entity_type',
  'collection' => 'entity.definitions.installed',
])
  ->execute();

// Install the message field storage definitions.
$connection
  ->merge('key_value')
  ->condition('collection', 'entity.definitions.installed')
  ->condition('name', 'message.field_storage_definitions')
  ->fields([
  'value' => 'a:8:{s:3:"mid";O:37:"Drupal\\Core\\Field\\BaseFieldDefinition":5:{s:7:"*type";s:7:"integer";s:9:"*schema";a:4:{s:7:"columns";a:1:{s:5:"value";a:3:{s:4:"type";s:3:"int";s:8:"unsigned";b:1;s:4:"size";s:6:"normal";}}s:11:"unique keys";a:0:{}s:7:"indexes";a:0:{}s:12:"foreign keys";a:0:{}}s:10:"*indexes";a:0:{}s:17:"*itemDefinition";O:51:"Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition":2:{s:18:"*fieldDefinition";r:2;s:13:"*definition";a:2:{s:4:"type";s:18:"field_item:integer";s:8:"settings";a:6:{s:8:"unsigned";b:1;s:4:"size";s:6:"normal";s:3:"min";s:0:"";s:3:"max";s:0:"";s:6:"prefix";s:0:"";s:6:"suffix";s:0:"";}}}s:13:"*definition";a:7:{s:5:"label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:10:"Message ID";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"description";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:15:"The message ID.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:9:"read-only";b:1;s:8:"provider";s:7:"message";s:10:"field_name";s:3:"mid";s:11:"entity_type";s:7:"message";s:6:"bundle";N;}}s:4:"uuid";O:37:"Drupal\\Core\\Field\\BaseFieldDefinition":5:{s:7:"*type";s:4:"uuid";s:9:"*schema";a:4:{s:7:"columns";a:1:{s:5:"value";a:3:{s:4:"type";s:13:"varchar_ascii";s:6:"length";i:128;s:6:"binary";b:0;}}s:11:"unique keys";a:1:{s:5:"value";a:1:{i:0;s:5:"value";}}s:7:"indexes";a:0:{}s:12:"foreign keys";a:0:{}}s:10:"*indexes";a:0:{}s:17:"*itemDefinition";O:51:"Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition":2:{s:18:"*fieldDefinition";r:39;s:13:"*definition";a:2:{s:4:"type";s:15:"field_item:uuid";s:8:"settings";a:3:{s:10:"max_length";i:128;s:8:"is_ascii";b:1;s:14:"case_sensitive";b:0;}}}s:13:"*definition";a:7:{s:5:"label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:4:"UUID";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"description";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:16:"The message UUID";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:9:"read-only";b:1;s:8:"provider";s:7:"message";s:10:"field_name";s:4:"uuid";s:11:"entity_type";s:7:"message";s:6:"bundle";N;}}s:8:"template";O:37:"Drupal\\Core\\Field\\BaseFieldDefinition":5:{s:7:"*type";s:16:"entity_reference";s:9:"*schema";a:4:{s:7:"columns";a:1:{s:9:"target_id";a:3:{s:11:"description";s:28:"The ID of the target entity.";s:4:"type";s:13:"varchar_ascii";s:6:"length";i:32;}}s:7:"indexes";a:1:{s:9:"target_id";a:1:{i:0;s:9:"target_id";}}s:11:"unique keys";a:0:{}s:12:"foreign keys";a:0:{}}s:10:"*indexes";a:0:{}s:17:"*itemDefinition";O:51:"Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition":2:{s:18:"*fieldDefinition";r:75;s:13:"*definition";a:2:{s:4:"type";s:27:"field_item:entity_reference";s:8:"settings";a:3:{s:11:"target_type";s:16:"message_template";s:7:"handler";s:7:"default";s:16:"handler_settings";a:0:{}}}}s:13:"*definition";a:7:{s:5:"label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:8:"Template";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"description";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:21:"The message template.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:9:"read-only";b:1;s:8:"provider";s:7:"message";s:10:"field_name";s:8:"template";s:11:"entity_type";s:7:"message";s:6:"bundle";N;}}s:8:"langcode";O:37:"Drupal\\Core\\Field\\BaseFieldDefinition":5:{s:7:"*type";s:8:"language";s:9:"*schema";a:4:{s:7:"columns";a:1:{s:5:"value";a:2:{s:4:"type";s:13:"varchar_ascii";s:6:"length";i:12;}}s:11:"unique keys";a:0:{}s:7:"indexes";a:0:{}s:12:"foreign keys";a:0:{}}s:10:"*indexes";a:0:{}s:17:"*itemDefinition";O:51:"Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition":2:{s:18:"*fieldDefinition";r:111;s:13:"*definition";a:2:{s:4:"type";s:19:"field_item:language";s:8:"settings";a:0:{}}}s:13:"*definition";a:7:{s:5:"label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:13:"Language code";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"description";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:26:"The message language code.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:12:"translatable";b:1;s:8:"provider";s:7:"message";s:10:"field_name";s:8:"langcode";s:11:"entity_type";s:7:"message";s:6:"bundle";N;}}s:3:"uid";O:37:"Drupal\\Core\\Field\\BaseFieldDefinition":5:{s:7:"*type";s:16:"entity_reference";s:9:"*schema";a:4:{s:7:"columns";a:1:{s:9:"target_id";a:3:{s:11:"description";s:28:"The ID of the target entity.";s:4:"type";s:3:"int";s:8:"unsigned";b:1;}}s:7:"indexes";a:1:{s:9:"target_id";a:1:{i:0;s:9:"target_id";}}s:11:"unique keys";a:0:{}s:12:"foreign keys";a:0:{}}s:10:"*indexes";a:0:{}s:17:"*itemDefinition";O:51:"Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition":2:{s:18:"*fieldDefinition";r:141;s:13:"*definition";a:2:{s:4:"type";s:27:"field_item:entity_reference";s:8:"settings";a:4:{s:11:"target_type";s:4:"user";s:7:"handler";s:7:"default";s:16:"handler_settings";a:0:{}s:13:"default_value";i:0;}}}s:13:"*definition";a:8:{s:5:"label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:10:"Created by";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"description";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:34:"The user that created the message.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:22:"default_value_callback";s:47:"Drupal\\message\\Entity\\Message::getCurrentUserId";s:12:"translatable";b:1;s:8:"provider";s:7:"message";s:10:"field_name";s:3:"uid";s:11:"entity_type";s:7:"message";s:6:"bundle";N;}}s:7:"created";O:37:"Drupal\\Core\\Field\\BaseFieldDefinition":5:{s:7:"*type";s:7:"created";s:9:"*schema";a:4:{s:7:"columns";a:1:{s:5:"value";a:1:{s:4:"type";s:3:"int";}}s:11:"unique keys";a:0:{}s:7:"indexes";a:0:{}s:12:"foreign keys";a:0:{}}s:10:"*indexes";a:0:{}s:17:"*itemDefinition";O:51:"Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition":2:{s:18:"*fieldDefinition";r:179;s:13:"*definition";a:2:{s:4:"type";s:18:"field_item:created";s:8:"settings";a:0:{}}}s:13:"*definition";a:7:{s:5:"label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:10:"Created on";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"description";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:38:"The time that the message was created.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:12:"translatable";b:1;s:8:"provider";s:7:"message";s:10:"field_name";s:7:"created";s:11:"entity_type";s:7:"message";s:6:"bundle";N;}}s:9:"arguments";O:37:"Drupal\\Core\\Field\\BaseFieldDefinition":5:{s:7:"*type";s:3:"map";s:9:"*schema";a:4:{s:7:"columns";a:1:{s:5:"value";a:3:{s:4:"type";s:4:"blob";s:4:"size";s:3:"big";s:9:"serialize";b:1;}}s:11:"unique keys";a:0:{}s:7:"indexes";a:0:{}s:12:"foreign keys";a:0:{}}s:10:"*indexes";a:0:{}s:17:"*itemDefinition";O:51:"Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition":2:{s:18:"*fieldDefinition";r:208;s:13:"*definition";a:2:{s:4:"type";s:14:"field_item:map";s:8:"settings";a:0:{}}}s:13:"*definition";a:6:{s:5:"label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:9:"Arguments";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"description";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:55:"Holds the arguments of the message in serialise format.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:8:"provider";s:7:"message";s:10:"field_name";s:9:"arguments";s:11:"entity_type";s:7:"message";s:6:"bundle";N;}}s:16:"default_langcode";O:37:"Drupal\\Core\\Field\\BaseFieldDefinition":5:{s:7:"*type";s:7:"boolean";s:9:"*schema";a:4:{s:7:"columns";a:1:{s:5:"value";a:2:{s:4:"type";s:3:"int";s:4:"size";s:4:"tiny";}}s:11:"unique keys";a:0:{}s:7:"indexes";a:0:{}s:12:"foreign keys";a:0:{}}s:10:"*indexes";a:0:{}s:17:"*itemDefinition";O:51:"Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition":2:{s:18:"*fieldDefinition";r:238;s:13:"*definition";a:2:{s:4:"type";s:18:"field_item:boolean";s:8:"settings";a:2:{s:8:"on_label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:2:"On";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:9:"off_label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:3:"Off";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}}}}s:13:"*definition";a:9:{s:5:"label";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:19:"Default translation";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"description";O:48:"Drupal\\Core\\StringTranslation\\TranslatableMarkup":3:{s:9:"*string";s:58:"A flag indicating whether this is the default translation.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:12:"translatable";b:1;s:12:"revisionable";b:1;s:13:"default_value";a:1:{i:0;a:1:{s:5:"value";b:1;}}s:8:"provider";s:7:"message";s:10:"field_name";s:16:"default_langcode";s:11:"entity_type";s:7:"message";s:6:"bundle";N;}}}',
  'name' => 'message.field_storage_definitions',
  'collection' => 'entity.definitions.installed',
])
  ->execute();