-
Notifications
You must be signed in to change notification settings - Fork 1
/
islandora_hierarchical_access.install
71 lines (65 loc) · 1.66 KB
/
islandora_hierarchical_access.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* @file
* Module (un)installation and update hooks.
*/
use Drupal\islandora_hierarchical_access\LUTGeneratorInterface;
/**
* Implements hook_schema().
*/
function islandora_hierarchical_access_schema(): array {
$schema = [];
$schema[LUTGeneratorInterface::TABLE_NAME] = [
'description' => 'Lookup table for flattened relationships.',
'fields' => [
'nid' => [
'description' => 'The relevant node ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'mid' => [
'description' => 'The relevant media ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'fid' => [
'description' => 'The relevant file ID.',
'type' => 'int',
'unsigned' => TRUE,
'default' => 0,
'not null' => TRUE,
],
],
'primary key' => ['nid', 'mid', 'fid'],
'indexes' => [
'node_id' => ['nid'],
'media_id' => ['mid'],
'file_id' => ['fid'],
],
'foreign keys' => [
'node_id_fk' => [
'table' => 'node',
'columns' => ['nid' => 'nid'],
],
'media_id_fk' => [
'table' => 'media',
'columns' => ['mid' => 'mid'],
],
'file_id_fk' => [
'table' => 'file_managed',
'columns' => ['fid' => 'fid'],
],
],
];
return $schema;
}
/**
* Implements hook_install().
*/
function islandora_hierarchical_access_install() {
/** @var \Drupal\islandora_hierarchical_access\LUTGeneratorInterface $lut_generator */
$lut_generator = Drupal::service('islandora_hierarchical_access.lut_generator');
$lut_generator->regenerate();
}