]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4239 rerun corrected blog status upgrade
authorcash <cash.costello@gmail.com>
Sat, 31 Dec 2011 14:55:25 +0000 (09:55 -0500)
committercash <cash.costello@gmail.com>
Sat, 31 Dec 2011 14:55:25 +0000 (09:55 -0500)
engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php [new file with mode: 0644]
version.php

diff --git a/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php b/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php
new file mode 100644 (file)
index 0000000..e351c6a
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Elgg 1.8.2 upgrade 2011123101
+ * fix_blog_status
+ *
+ * Most blog posts did not have their status properly set with 1.8 upgrade so we run
+ * the blog status upgrade again
+ */
+
+$ia = elgg_set_ignore_access(true);
+$options = array(
+       'type' => 'object',
+       'subtype' => 'blog',
+       'limit' => 0,
+);
+$batch = new ElggBatch('elgg_get_entities', $options);
+
+foreach ($batch as $entity) {
+       if (!$entity->status) {
+               // create metadata owned by the original owner
+               create_metadata($entity->getGUID(), 'status', 'published', '', $entity->owner_guid,
+                       $entity->access_id);
+       }
+}
+elgg_set_ignore_access($ia);
\ No newline at end of file
index 08c1e2513909e44cfb517ebe88fca53b0139f545..455f77ad1835d11fc5df7a0ae8ff24547edb1b24 100644 (file)
@@ -11,7 +11,7 @@
 
 // YYYYMMDD = Elgg Date
 // XX = Interim incrementer
-$version = 2011123100;
+$version = 2011123101;
 
 // Human-friendly version name
 $release = '1.8.2';