aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/upgrades/2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php
blob: 8eccf05e2b2c30f4575e63d13803628bbb7895e0 (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
<?php
/**
 * Elgg 1.8.14 upgrade 2013030600
 * update_user_location
 *
 * Before Elgg 1.8, a location like "London, England" would be stored as an array.
 * This script turns that back into a string.
 */

$ia = elgg_set_ignore_access(true);
$options = array(
	'type' => 'user',
	'limit' => 0,
);
$batch = new ElggBatch('elgg_get_entities', $options);

foreach ($batch as $entity) {
	_elgg_invalidate_query_cache();
	
	if (is_array($entity->location)) {
		$entity->location = implode(', ', $entity->location);
	}
}
elgg_set_ignore_access($ia);