aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/upgrades/2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2013-03-06 15:26:14 -0500
committercash <cash.costello@gmail.com>2013-03-06 15:26:14 -0500
commit4b889e9cc7c629bb408fc8e470a80a7ab283fffc (patch)
treeb1eee5875bc6925419d454b03484e744f204b4ef /engine/lib/upgrades/2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php
parent66c4d2ac5d6c538f7fa2ddd472bfaf9bb7cc9551 (diff)
downloadelgg-4b889e9cc7c629bb408fc8e470a80a7ab283fffc.tar.gz
elgg-4b889e9cc7c629bb408fc8e470a80a7ab283fffc.tar.bz2
Fixes #4566 upgrades location metadata on users
Diffstat (limited to 'engine/lib/upgrades/2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php')
-rw-r--r--engine/lib/upgrades/2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/engine/lib/upgrades/2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php b/engine/lib/upgrades/2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php
new file mode 100644
index 000000000..b38eb5100
--- /dev/null
+++ b/engine/lib/upgrades/2013030600-1.8.13-update_user_location-8999eb8bf1bdd9a3.php
@@ -0,0 +1,26 @@
+<?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.
+ */
+
+global $DB_QUERY_CACHE;
+
+$ia = elgg_set_ignore_access(true);
+$options = array(
+ 'type' => 'user',
+ 'limit' => 0,
+);
+$batch = new ElggBatch('elgg_get_entities', $options);
+
+foreach ($batch as $entity) {
+ $DB_QUERY_CACHE = array();
+
+ if (is_array($entity->location)) {
+ $entity->location = implode(', ', $entity->location);
+ }
+}
+elgg_set_ignore_access($ia);