blob: 789a73e0ad5926187d2bc884be6edf1938634e28 (
plain)
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
|
<?php
global $MIGRATED;
$local_version = (int)elgg_get_plugin_setting('version', 'openid_client');
if (2012022501 <= $local_version) {
error_log("Openid client requires no upgrade");
// no upgrade required
return;
}
/**
* Save previous author id
*/
function openid_client_user_2012100501($user) {
$MIGRATED += 1;
if ($MIGRATED % 100 == 0) {
error_log(" * openid user $user->guid");
}
if ($user->alias) {
$alias = $user->alias;
if (strpos($alias, 'pg/profile') !== FALSE) {
$alias = str_replace('pg/profile', 'profile', $alias);
}
error_log($alias);
$user->annotate('openid_identifier', $alias, ACCESS_PUBLIC);
}
return true;
}
/*
* Run upgrade. First users, then pads
*/
// users
$options = array('type' => 'user', 'limit' => 0);
$MIGRATED = 0;
$previous_access = elgg_set_ignore_access(true);
$batch = new ElggBatch('elgg_get_entities', $options, "openid_client_user_2012100501", 100);
elgg_set_ignore_access($previous_access);
if ($batch->callbackResult) {
error_log("Elgg openid users upgrade (201210050) succeeded");
elgg_set_plugin_setting('version', 2012022501, 'openid_client');
} else {
error_log("Elgg openid users upgrade (201210050) failed");
}
|