diff options
author | Pablo Martin <caedes@sindominio.net> | 2012-11-05 08:23:21 +0000 |
---|---|---|
committer | root <root@ops.vz.lan> | 2012-11-05 08:23:26 +0000 |
commit | c631c4c4ed4c403ad152b2bdfc1c03f3ace48465 (patch) | |
tree | 6ce3101628efec82a38bdf3b9ae6290acdcf16eb /upgrades | |
parent | 347414453e74e7e8cad25820d9a77449edb8355c (diff) | |
download | elgg-c631c4c4ed4c403ad152b2bdfc1c03f3ace48465.tar.gz elgg-c631c4c4ed4c403ad152b2bdfc1c03f3ace48465.tar.bz2 |
add upgrade scripts.
Diffstat (limited to 'upgrades')
-rw-r--r-- | upgrades/2012100501.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/upgrades/2012100501.php b/upgrades/2012100501.php new file mode 100644 index 000000000..789a73e0a --- /dev/null +++ b/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"); +} + + |