-
Notifications
You must be signed in to change notification settings - Fork 6
/
cmrf_core.install
140 lines (128 loc) · 3.42 KB
/
cmrf_core.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
/**
* @file
* Install and uninstall code for Custom Module.
*
* Long description here.
*/
require_once(dirname(__FILE__) . '/vendor/autoload.php');
/**
* Implements hook_install().
*/
function cmrf_core_install() {
// Create default profile.
module_load_all_includes('module', 'cmrf_core');
$default_profile = array(
'name' => 'default',
'label' => t('Default'),
'connector' => 'local',
'is_new' => TRUE,
);
cmrf_core_profile_save($default_profile);
}
/**
* Implements hook_uninstall().
*/
function cmrf_core_uninstall() {
// Do some things on uninstall, like deleting all variables.
}
/**
* Change request and reply to long text. So it could hold attachment data
*
*/
function cmrf_core_update_7100(&$sandbox) {
db_change_field('cmrf_core_call', 'request', 'request', array(
'description' => 'The request data sent',
'type' => 'text',
'size' => 'big',
'serialize' => FALSE,
'not null' => FALSE,
));
db_change_field('cmrf_core_call', 'reply', 'reply', array(
'description' => 'The reply data received',
'type' => 'text',
'size' => 'big',
'serialize' => FALSE,
'not null' => FALSE,
));
}
function cmrf_core_update_7102(&$sandbox) {
db_add_field('cmrf_core_profiles', 'cache_expire_days', array(
'description' => 'Clear the cache after n days (Set to 0 to disable).',
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
'default' => '0',
));
}
/**
* Implements hook_schema().
*/
function cmrf_core_schema() {
$schema = array();
$schema['cmrf_core_call'] = \CMRF\PersistenceLayer\SQLPersistingCallFactory::schema();
$schema['cmrf_core_profiles'] = array(
'description' => 'Stores CiviMRF connection profiles.',
'fields' => array(
'pid' => array(
'description' => 'The primary identifier for an profile.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'The profile machine name.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'label' => array(
'description' => 'The profile administrative name.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'connector' => array(
'description' => 'The connector for this profile.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'url' => array(
'description' => 'The URL to the rest endpoint of CiviCRM.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
),
'site_key' => array(
'description' => 'The site key of CiviCRM.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
),
'api_key' => array(
'description' => 'The api key of CiviCRM.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
),
'cache_expire_days' => array(
'description' => 'Clear the cache after n days (Set to 0 to disable).',
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
'default' => '0',
),
),
'primary key' => array('pid'),
'unique keys' => array(
'name' => array('name'),
),
);
return $schema;
}