diff options
author | Sem <sembrestels@riseup.net> | 2013-11-09 16:25:34 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2013-11-09 16:25:34 +0100 |
commit | 2161e2335c9c650b8e44a56f6c9b0bd37546ae1f (patch) | |
tree | 91bef55b773a7a80b5f6a065411574bdbe9fe522 /mod/openid_client/upgrades/2012100501.php | |
parent | a9ac4c861335e60373c1e99b61372e6e0d6ac9f4 (diff) | |
parent | 11ea6ae4734a0e722c6ecaaee90e9ab772e8d2cc (diff) | |
download | elgg-2161e2335c9c650b8e44a56f6c9b0bd37546ae1f.tar.gz elgg-2161e2335c9c650b8e44a56f6c9b0bd37546ae1f.tar.bz2 |
Add 'mod/openid_client/' from commit '11ea6ae4734a0e722c6ecaaee90e9ab772e8d2cc'
git-subtree-dir: mod/openid_client
git-subtree-mainline: a9ac4c861335e60373c1e99b61372e6e0d6ac9f4
git-subtree-split: 11ea6ae4734a0e722c6ecaaee90e9ab772e8d2cc
Diffstat (limited to 'mod/openid_client/upgrades/2012100501.php')
-rw-r--r-- | mod/openid_client/upgrades/2012100501.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/mod/openid_client/upgrades/2012100501.php b/mod/openid_client/upgrades/2012100501.php new file mode 100644 index 000000000..789a73e0a --- /dev/null +++ b/mod/openid_client/upgrades/2012100501.php @@ -0,0 +1,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"); +} + + |