From 740d6a543605e6179b77c996aae3030b96069c5e Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 8 Jun 2011 22:41:21 +0000 Subject: Refs #3510, #3416. Merged update for making sure users have relationship member_of on site object. git-svn-id: http://code.elgg.org/elgg/trunk@9144 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/upgrades/2011052801.php | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 engine/lib/upgrades/2011052801.php (limited to 'engine/lib/upgrades') diff --git a/engine/lib/upgrades/2011052801.php b/engine/lib/upgrades/2011052801.php new file mode 100644 index 000000000..8084bc06c --- /dev/null +++ b/engine/lib/upgrades/2011052801.php @@ -0,0 +1,45 @@ +guid', + 'member_of_site', + '$user->site_guid', + '$user->time_created' + )"; + + insert_data($rel_q); + } + + // every time we run this query we've just reduced the rows it returns by $limit + // so don't pass an offset. + $q = "SELECT e.* FROM {$db_prefix}entities e + WHERE e.type = 'user' AND e.guid NOT IN ( + SELECT guid_one FROM {$db_prefix}entity_relationships + WHERE guid_two = 1 AND relationship = 'member_of_site' + ) + LIMIT $limit"; + + $users = get_data($q); +} \ No newline at end of file -- cgit v1.2.3 From ba88a1c96ab89b4afcc574e3fc8a71df640a9fd8 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 12 Jun 2011 21:07:49 +0000 Subject: Fixes #2910 set the site_guid of site entities git-svn-id: http://code.elgg.org/elgg/trunk@9192 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggSite.php | 9 +++++++ ...8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php | 30 ++++++++++++++++++++++ version.php | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php (limited to 'engine/lib/upgrades') diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 30b222c24..e3b8b8f1a 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -148,11 +148,20 @@ class ElggSite extends ElggEntity { * @return bool */ public function save() { + global $CONFIG; + // Save generic stuff if (!parent::save()) { return false; } + // make sure the site guid is set (if not, set to self) + if (!$this->get('site_guid')) { + $guid = $this->get('guid'); + update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid=$guid + WHERE guid=$guid"); + } + // Now save specific stuff return create_site_entity($this->get('guid'), $this->get('name'), $this->get('description'), $this->get('url')); 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 @@ + '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); diff --git a/version.php b/version.php index d1cc63aef..9d3bf43e3 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2011052801; +$version = 2011061200; // Human-friendly version name $release = '1.8b1'; -- cgit v1.2.3