aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/upgrades/2010111501.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-16 02:12:57 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-16 02:12:57 +0000
commit89c57a8eeb223974a64dfbb28e6314e63a7fe9ec (patch)
treed5d81d6a81754b126ecd075f449206bd5c75c017 /engine/lib/upgrades/2010111501.php
parenta9acf7d6f8f9af7e5d031e004e2ed207ac3e3aba (diff)
downloadelgg-89c57a8eeb223974a64dfbb28e6314e63a7fe9ec.tar.gz
elgg-89c57a8eeb223974a64dfbb28e6314e63a7fe9ec.tar.bz2
Fixes #2573 upgrade script for new user validation approach
git-svn-id: http://code.elgg.org/elgg/trunk@7326 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/upgrades/2010111501.php')
-rw-r--r--engine/lib/upgrades/2010111501.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/engine/lib/upgrades/2010111501.php b/engine/lib/upgrades/2010111501.php
new file mode 100644
index 000000000..15e4a7d35
--- /dev/null
+++ b/engine/lib/upgrades/2010111501.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Set validation metadata on unvalidated users to false rather than
+ * not existing. This is needed because of the change in how validation is
+ * being handled.
+ */
+
+// turn off system log because of all the metadata this can create
+elgg_unregister_event_handler('all', 'all', 'system_log_listener');
+elgg_unregister_event_handler('log', 'systemlog', 'system_log_default_logger');
+
+$ia = elgg_set_ignore_access(TRUE);
+$hidden_entities = access_get_show_hidden_status();
+access_show_hidden_entities(TRUE);
+
+$validated_id = get_metastring_id('validated');
+$one_id = get_metastring_id(1);
+
+$query = "SELECT guid FROM {$CONFIG->dbprefix}entities e
+ WHERE e.type = 'user' AND e.enabled = 'no' AND
+ NOT EXISTS (
+ SELECT 1 FROM {$CONFIG->dbprefix}metadata md
+ WHERE md.entity_guid = e.guid
+ AND md.name_id = $validated_id
+ AND md.value_id = $one_id)";
+
+$user_guids = mysql_query($query);
+while ($user_guid = mysql_fetch_object($user_guids)) {
+ create_metadata($user_guid->guid, 'validated', false, '', 0, ACCESS_PUBLIC, false);
+}
+
+access_show_hidden_entities($hidden_entities);
+elgg_set_ignore_access($ia);