aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/upgrades
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups/upgrades')
-rw-r--r--mod/groups/upgrades/2011030101.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/mod/groups/upgrades/2011030101.php b/mod/groups/upgrades/2011030101.php
index c2a80c08c..55edb1a16 100644
--- a/mod/groups/upgrades/2011030101.php
+++ b/mod/groups/upgrades/2011030101.php
@@ -9,6 +9,7 @@ $topics = elgg_get_entities(array(
'type' => 'object',
'subtype' => 'groupforumtopic',
'limit' => 5,
+ 'order_by' => 'e.time_created asc',
));
// if not topics, no upgrade required
@@ -25,12 +26,17 @@ foreach ($topics as $topic) {
/**
- * Condense annotation into object
+ * Condense first annotation into object
*
* @param ElggObject $topic
*/
function groups_2011030101($topic) {
+ // do not upgrade topics that have already been upgraded
+ if ($topic->description) {
+ return true;
+ }
+
$annotation = $topic->getAnnotations('group_topic_post', 1);
if (!$annotation) {
// no text for this forum post so we delete (probably caused by #2624)
@@ -43,8 +49,14 @@ function groups_2011030101($topic) {
return $annotation[0]->delete();
}
-$options = array('type' => 'object', 'subtype' => 'groupforumtopic');
+$previous_access = elgg_set_ignore_access(true);
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'groupforumtopic',
+ 'limit' => 0,
+);
$batch = new ElggBatch('elgg_get_entities', $options, 'groups_2011030101', 100);
+elgg_set_ignore_access($previous_access);
if ($batch->callbackResult) {
error_log("Elgg Groups upgrade (2011030101) succeeded");