forked from backdrop-contrib/hybridauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hybridauth.install
230 lines (219 loc) · 9.53 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<?php
/**
* @file
* Install, update and uninstall functions for the HybridAuth module.
*/
/**
* Implements hook_requirements().
*/
function hybridauth_requirements($phase) {
module_load_include('module', 'hybridauth');
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
if ($phase == 'install' || $phase == 'runtime') {
if ($lib_path = _hybridauth_library_path()) {
try {
require_once $lib_path . '/autoload.php';
$requirements['hybridauth'] = array(
'title' => $t('HybridAuth library'),
'value' => '3.7.1',
'severity' => REQUIREMENT_OK,
);
}
catch (Exception $e) {
$requirements['hybridauth'] = array(
'title' => $t('HybridAuth library'),
'description' => $e->getMessage(),
'severity' => REQUIREMENT_ERROR,
);
}
}
else {
$requirements['hybridauth'] = array(
'title' => $t('HybridAuth library'),
'description' => $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;
}
/**
* Implements hook_update_last_removed().
*/
function hybridauth_update_last_removed() {
return 7006;
}
/**
* Implements hook_update_N().
*/
function hybridauth_update_1000() {
$config = config('hybridauth.settings');
$config->set('hybridauth_register', update_variable_get('hybridauth_register', 'novalue'));
$config->set('hybridauth_providers', update_variable_get('hybridauth_providers', array()));
$config->set('hybridauth_required_fields', update_variable_get('hybridauth_required_fields', array('email' => 'email')));
$config->set('hybridauth_widget_title', update_variable_get('hybridauth_widget_title', 'Or log in with...'));
$config->set('hybridauth_widget_type', update_variable_get('hybridauth_widget_type', 'list'));
$config->set('hybridauth_widget_use_overlay', update_variable_get('hybridauth_widget_use_overlay', '1'));
$config->set('hybridauth_widget_link_text', update_variable_get('hybridauth_widget_link_text', 'Social network account'));
$config->set('hybridauth_widget_link_title', update_variable_get('hybridauth_widget_link_title', 'Social network account'));
$config->set('hybridauth_widget_icon_pack', update_variable_get('hybridauth_widget_icon_pack', 'hybridauth_32'));
$config->set('hybridauth_widget_weight', update_variable_get('hybridauth_widget_weight', '100'));
$config->set('hybridauth_widget_hide_links', update_variable_get('hybridauth_widget_hide_links', 'novalue'));
$config->set('hybridauth_email_verification', update_variable_get('hybridauth_email_verification', 'novalue'));
$config->set('hybridauth_pictures', update_variable_get('hybridauth_pictures', '1'));
$config->set('hybridauth_username', update_variable_get('hybridauth_username', '[user:hybridauth:firstName] [user:hybridauth:lastName]'));
$config->set('hybridauth_display_name', update_variable_get('hybridauth_display_name', '[user:hybridauth:firstName] [user:hybridauth:lastName]'));
$config->set('hybridauth_registration_username_change', update_variable_get('hybridauth_registration_username_change', 'novalue'));
$config->set('hybridauth_registration_password', update_variable_get('hybridauth_registration_password', 'novalue'));
$config->set('hybridauth_override_realname', update_variable_get('hybridauth_override_realname', 'novalue'));
$config->set('hybridauth_disable_username_change', update_variable_get('hybridauth_disable_username_change', '1'));
$config->set('hybridauth_remove_password_fields', update_variable_get('hybridauth_remove_password_fields', '1'));
$config->set('hybridauth_forms', update_variable_get('hybridauth_forms', array('user_login', 'user_login_block')));
$config->set('hybridauth_destination', update_variable_get('hybridauth_destination', ''));
$config->set('hybridauth_destination_error', update_variable_get('hybridauth_destination_error', ''));
$config->set('hybridauth_duplicate_emails', update_variable_get('hybridauth_duplicate_emails', '1'));
$config->set('hybridauth_proxy', update_variable_get('hybridauth_proxy', 'NULL'));
$config->set('hybridauth_debug', update_variable_get('hybridauth_debug', 'FALSE'));
$config->set('hybridauth_library_path', update_variable_get('hybridauth_library_path', ''));
update_variable_del('hybridauth_register');
update_variable_del('hybridauth_providers');
update_variable_del('hybridauth_required_fields');
update_variable_del('hybridauth_widget_title');
update_variable_del('hybridauth_widget_type');
update_variable_del('hybridauth_widget_use_overlay');
update_variable_del('hybridauth_widget_link_text');
update_variable_del('hybridauth_widget_link_title');
update_variable_del('hybridauth_widget_icon_pack');
update_variable_del('hybridauth_widget_weight');
update_variable_del('hybridauth_widget_hide_links');
update_variable_del('hybridauth_email_verification');
update_variable_del('hybridauth_pictures');
update_variable_del('hybridauth_username');
update_variable_del('hybridauth_display_name');
update_variable_del('hybridauth_registration_username_change');
update_variable_del('hybridauth_registration_password');
update_variable_del('hybridauth_override_realname');
update_variable_del('hybridauth_disable_username_change');
update_variable_del('hybridauth_remove_password_fields');
update_variable_del('hybridauth_forms');
update_variable_del('hybridauth_destination');
update_variable_del('hybridauth_destination_error');
update_variable_del('hybridauth_duplicate_emails');
update_variable_del('hybridauth_proxy');
update_variable_del('hybridauth_debug');
update_variable_del('hybridauth_provider_provider_id_keys_id');
update_variable_del('hybridauth_provider_provider_id_keys_key');
update_variable_del('hybridauth_provider_provider_id_keys_secret');
update_variable_del('hybridauth_provider_provider_id_window_type');
update_variable_del('hybridauth_provider_provider_id_window_width');
update_variable_del('hybridauth_provider_provider_id_window_height');
update_variable_del('hybridauth_provider_provider_id_enabled');
update_variable_del('hybridauth_provider_provider_id_weight');
update_variable_del('hybridauth_provider_provider_id_scope');
update_variable_del('hybridauth_provider_provider_id_display');
update_variable_del('hybridauth_library_path');
update_variable_del('hybridauth_provider_provider_id_oauth_server');
update_variable_del('hybridauth_provider_provider_id_skipssl');
update_variable_del('hybridauth_provider_provider_id_proxy');
update_variable_del('hybridauth_provider_provider_id_certificate_path');
update_variable_del('hybridauth_provider_provider_id_private_key_path');
update_variable_del('hybridauth_provider_provider_id_private_key_pass');
update_variable_del('hybridauth_provider_provider_id_trustForwarded');
update_variable_del('hybridauth_provider_provider_id_includeEmail');
}
/**
* Implements hook_install().
*/
function hybridauth_install() {
}