content_sync.install in Content Synchronization 3.0.x
Same filename and directory in other branches
Install, update and uninstall functions for the content_sync module.
File
content_sync.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the content_sync module.
*/
/**
* Implements hook_install().
*/
function content_sync_install() {
//Create the content snapshot.
$cs_snapshoot = Drupal::service('content_sync.snaphoshot');
$cs_snapshoot
->snapshot();
}
/**
* Implements hook_schema().
*/
function content_sync_schema() {
// Content Sync Table - DB Snapshot.
$schema['cs_db_snapshot'] = [
'description' => 'The base table for content data.',
'fields' => [
'collection' => [
'description' => 'Primary Key: Content object collection.',
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => '',
],
'name' => [
'description' => 'Primary Key: Content object name.',
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => '',
],
'data' => [
'description' => 'A serialized content object data.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
],
],
'primary key' => [
'collection',
'name',
],
];
// Content Sync Logs Table
$schema['cs_logs'] = [
'description' => 'Table that contains content_sync logs.',
'fields' => [
'csid' => [
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique content_sync event ID.',
],
'uid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {users}.uid of the user who triggered the event.',
],
'type' => [
'type' => 'varchar_ascii',
'length' => 64,
'not null' => TRUE,
'default' => '',
'description' => 'Type of log message, for example "Import" or "Export"',
],
'message' => [
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'description' => 'Text of log message to be passed into the t() function.',
],
'variables' => [
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
'description' => 'Serialized array of variables that match the message string and that is passed into the t() function.',
],
'severity' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
],
'link' => [
'type' => 'text',
'not null' => FALSE,
'description' => 'Link to view the result of the event.',
],
'location' => [
'type' => 'text',
'not null' => TRUE,
'description' => 'URL of the origin of the event.',
],
'referer' => [
'type' => 'text',
'not null' => FALSE,
'description' => 'URL of referring page.',
],
'hostname' => [
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'Hostname of the user who triggered the event.',
],
'timestamp' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Unix timestamp of when event occurred.',
],
],
'primary key' => [
'csid',
],
'indexes' => [
'type' => [
'type',
],
'uid' => [
'uid',
],
'severity' => [
'severity',
],
],
];
return $schema;
}
Functions
Name | Description |
---|---|
content_sync_install | Implements hook_install(). |
content_sync_schema | Implements hook_schema(). |