2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php 604 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * Elgg 1.8.14 upgrade 2013030600
  4. * update_user_location
  5. *
  6. * Before Elgg 1.8, a location like "London, England" would be stored as an array.
  7. * This script turns that back into a string.
  8. */
  9. $ia = elgg_set_ignore_access(true);
  10. $options = array(
  11. 'type' => 'user',
  12. // only grab users that have set their location
  13. 'metadata_name' => 'location',
  14. 'limit' => 0,
  15. );
  16. $batch = new \ElggBatch('elgg_get_entities_from_metadata', $options);
  17. foreach ($batch as $entity) {
  18. if (is_array($entity->location)) {
  19. $entity->location = implode(', ', $entity->location);
  20. }
  21. }
  22. elgg_set_ignore_access($ia);