diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-06-12 21:07:49 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-06-12 21:07:49 +0000 |
commit | ba88a1c96ab89b4afcc574e3fc8a71df640a9fd8 (patch) | |
tree | c188d7946545e73b63517387c8b5d65d13fec059 /engine/lib/upgrades | |
parent | cf30721c8fa78bd9b2d10a387735c0080021b3c5 (diff) | |
download | elgg-ba88a1c96ab89b4afcc574e3fc8a71df640a9fd8.tar.gz elgg-ba88a1c96ab89b4afcc574e3fc8a71df640a9fd8.tar.bz2 |
Fixes #2910 set the site_guid of site entities
git-svn-id: http://code.elgg.org/elgg/trunk@9192 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/upgrades')
-rw-r--r-- | engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php new file mode 100644 index 000000000..4fc59ac41 --- /dev/null +++ b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php @@ -0,0 +1,30 @@ +<?php +/** + * Elgg 1.8b1 upgrade 2011061200 + * sites_need_a_site_guid + * + * Sites did not have a site guid. This causes problems with getting + * metadata on site objects since we default to the current site. + */ + +global $CONFIG; + +$ia = elgg_set_ignore_access(true); +$access_status = access_get_show_hidden_status(); +access_show_hidden_entities(true); + +$options = array( + 'type' => 'site', + 'site_guid' => 0, +); +$batch = new ElggBatch('elgg_get_entities', $options); + +foreach ($batch as $entity) { + if (!$entity->site_guid) { + update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid=$entity->guid + WHERE guid=$entity->guid"); + } +} + +access_show_hidden_entities($access_status); +elgg_set_ignore_access($ia); |