aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/upgrades/2011030101.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-01-12 16:15:16 +0100
committerSem <sembrestels@riseup.net>2012-01-12 16:15:16 +0100
commitcc544cfa2086e418318a899ffd550adfb744c7ba (patch)
tree6c04fbe2e3df67513aa76803cb8d05c105ba219b /mod/groups/upgrades/2011030101.php
parente7d64510ebd823f186282e2b80780295bcca1b79 (diff)
parent68e4829ac0959d86c651e7ed6dc255c39694c8af (diff)
downloadelgg-cc544cfa2086e418318a899ffd550adfb744c7ba.tar.gz
elgg-cc544cfa2086e418318a899ffd550adfb744c7ba.tar.bz2
Merge Elgg 1.8.3.
Diffstat (limited to 'mod/groups/upgrades/2011030101.php')
-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");