-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhybridauth.install
200 lines (186 loc) · 5.78 KB
/
hybridauth.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
/**
* @file
* Install, update and uninstall functions for the HybridAuth module.
*/
/**
* Implements hook_install().
*/
function hybridauth_install() {
}
/**
* Implements hook_uninstall().
*/
function hybridauth_uninstall() {
module_load_include('module', 'hybridauth');
foreach (hybridauth_providers_list() as $provider_id => $provider_name) {
variable_del('hybridauth_provider_' . $provider_id . '_enabled');
variable_del('hybridauth_provider_' . $provider_id . '_weight');
variable_del('hybridauth_provider_' . $provider_id . '_keys_id');
variable_del('hybridauth_provider_' . $provider_id . '_keys_key');
variable_del('hybridauth_provider_' . $provider_id . '_keys_secret');
variable_del('hybridauth_provider_' . $provider_id . '_scope');
}
variable_del('hybridauth_library_path');
variable_del('hybridauth_required_fields');
variable_del('hybridauth_widget_title');
variable_del('hybridauth_widget_type');
variable_del('hybridauth_widget_use_overlay');
variable_del('hybridauth_widget_link_text');
variable_del('hybridauth_widget_link_title');
variable_del('hybridauth_widget_icon_pack');
variable_del('hybridauth_widget_weight');
variable_del('hybridauth_disable_username_change');
variable_del('hybridauth_remove_password_fields');
variable_del('hybridauth_pictures');
variable_del('hybridauth_register');
variable_del('hybridauth_email_verification');
variable_del('hybridauth_username');
variable_del('hybridauth_registration_username_change');
variable_del('hybridauth_registration_role_choice');
variable_del('hybridauth_registration_roles');
variable_del('hybridauth_display_name');
variable_del('hybridauth_override_realname');
variable_del('hybridauth_destination');
variable_del('hybridauth_forms');
variable_del('hybridauth_duplicate_emails');
variable_del('hybridauth_debug');
}
/**
* Implements hook_requirements().
*/
function hybridauth_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time
$t = get_t();
if ($phase == 'runtime') {
if ($lib_path = _hybridauth_library_path()) {
try {
require_once($lib_path . '/Hybrid/Auth.php');
$requirements['hybridauth'] = array(
'title' => $t('HybridAuth library'),
'value' => Hybrid_Auth::$version,
'severity' => REQUIREMENT_OK,
);
}
catch(Exception $e) {
$requirements['hybridauth'] = array(
'title' => $t('HybridAuth library'),
'value' => $e->getMessage(),
'severity' => REQUIREMENT_ERROR,
);
}
}
else {
$requirements['hybridauth'] = array(
'title' => $t('HybridAuth library'),
'value' => $t('HybridAuth library is missing'),
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
/**
* Implements hook_schema().
*/
function hybridauth_schema() {
$schema = array();
$schema['hybridauth_identity'] = array(
'description' => 'Holds identities from HybridAuth library.',
'fields' => array(
'id' => array(
'description' => 'Unique ID of HybridAuth identity.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'description' => 'The {users}.uid that owns this HybridAuth identity.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'provider' => array(
'description' => 'The authentication provider for this HybridAuth identity.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'provider_identifier' => array(
'description' => 'The authentication provider UID for this HybridAuth identity.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'data' => array(
'description' => 'A serialized array containing information from HybridAuth library.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'normal',
),
),
'indexes' => array(
'uid' => array('uid'),
),
'unique keys' => array(
'provider_provider_identifier' => array('provider', 'provider_identifier'),
),
'foreign keys' => array(
'hybridauth_identity_user' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
),
'primary key' => array('id'),
);
$schema['hybridauth_session'] = array(
'description' => 'Holds sessions data from HybridAuth library.',
'fields' => array(
'uid' => array(
'description' => 'The {users}.uid that owns this HybridAuth session data.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'data' => array(
'description' => 'A serialized array containing session data from HybridAuth library.',
'type' => 'text',
'not null' => TRUE,
'size' => 'medium',
),
'updated' => array(
'description' => 'The Unix timestamp when the session was saved.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'foreign keys' => array(
'hybridauth_session_user' => array(
'table' => 'users',
'columns' => array('uid' => 'uid'),
),
),
'primary key' => array('uid'),
);
return $schema;
}
/**
* Add hybridauth_session DB table.
*/
function hybridauth_update_7001(&$sandbox) {
if (!db_table_exists('hybridauth_session')) {
$schema = hybridauth_schema();
db_create_table('hybridauth_session', $schema['hybridauth_session']);
}
}
/**
* Set us at schema rev 7000 as a base version.
*/
function hybridauth_update_7000(&$sandbox) {
}