-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapi.install
138 lines (133 loc) · 3.59 KB
/
capi.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
<?php
/**
* @file
* Contains install and update functions for Meta Conversions API.
*/
/**
* Implements hook_schema().
*/
function capi_schema() {
$schema['capi_log'] = [
'description' => 'The base table for CAPI event logging.',
'fields' => [
'elid' => [
'description' => 'The primary identifier for a log record.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'uid' => [
'description' => 'The {users}.uid that created this log entry.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'event_name' => [
'description' => 'The event name of the logged event.',
'type' => 'varchar',
'not null' => TRUE,
'length' => 512,
'default' => '',
],
'ip_address' => [
'description' => 'The IP address of the user.',
'type' => 'varchar',
'not null' => FALSE,
'length' => 512,
'default' => '',
],
'user_agent' => [
'description' => "The browser's user agent.",
'type' => 'varchar',
'not null' => FALSE,
'length' => 512,
'default' => '',
],
'source_url' => [
'description' => 'The source URL of the event.',
'type' => 'varchar',
'not null' => FALSE,
'length' => 512,
'default' => '',
],
'fbp' => [
'description' => 'The value of the _fbp cookie.',
'type' => 'varchar',
'not null' => FALSE,
'length' => 512,
'default' => '',
],
'fbc' => [
'description' => 'The value of the _fbc cookie.',
'type' => 'varchar',
'not null' => FALSE,
'length' => 512,
'default' => '',
],
'user_data' => [
'description' => 'A serialized configuration object for user data.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
],
'custom_data' => [
'description' => 'A serialized configuration object for custom data.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
],
'event_data' => [
'description' => 'A serialized configuration object for event data.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
],
'response_data' => [
'description' => 'A serialized configuration object for response data.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
],
'created' => [
'description' => 'The Unix timestamp of when the event occurred.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => ['elid'],
'indexes' => [
'uid' => ['uid'],
],
];
return $schema;
}
/**
* Implements hook_requirements().
*
* Checks for Meta/Facebook Business SDK library installation.
*/
function capi_requirements($phase): array {
if ($phase == 'runtime') {
if (!class_exists('FacebookAds\Api')) {
return [
'capi' => [
'title' => t('The Meta/Facebook Business SDK library is missing.'),
'description' => t('The Meta/Facebook Business SDK library is missing.'),
'severity' => REQUIREMENT_ERROR,
],
];
}
else {
return [
'capi' => [
'title' => t('Meta/Facebook Business SDK library'),
'description' => t('The Meta/Facebook Business SDK library is correctly installed.'),
'severity' => REQUIREMENT_OK,
],
];
}
}
return [];
}