diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-12-29 20:45:58 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-12-29 20:45:58 -0200 |
commit | 97e689213ff4e829f251af526ed4e796a3cc2b71 (patch) | |
tree | b04d03ec56305041216b72328fc9b5afde27bc76 /mod/openid_client/upgrades/2012100501.php | |
parent | 0ab6351abb7a602d96c62b0ad35413c88113a6cf (diff) | |
parent | 69e2d8c5d8732042c9319aef1fdea45a82b63e42 (diff) | |
download | elgg-97e689213ff4e829f251af526ed4e796a3cc2b71.tar.gz elgg-97e689213ff4e829f251af526ed4e796a3cc2b71.tar.bz2 |
Merge branch 'master' into saravea
Conflicts:
.gitmodules
mod/admins
mod/assemblies
mod/audio_html5
mod/beechat
mod/crud
mod/elgg-activitystreams
mod/elggman
mod/elggpg
mod/favorites
mod/federated-objects
mod/friendly_time
mod/group_alias
mod/group_operators
mod/languages
mod/lightpics
mod/openid_client
mod/spotlight
mod/suicide
mod/tasks
mod/videolist
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"); +} + + |