aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/upgrades
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-12-31 09:55:25 -0500
committercash <cash.costello@gmail.com>2011-12-31 09:55:25 -0500
commitbe12f79b9dd16202b774b4c42e07be395f00eff7 (patch)
tree80e48c4ccd2c697b940be5842d0234fe0be209d0 /engine/lib/upgrades
parentc5cee37b025a2654d1a5c427ac7a709ecf4b5350 (diff)
downloadelgg-be12f79b9dd16202b774b4c42e07be395f00eff7.tar.gz
elgg-be12f79b9dd16202b774b4c42e07be395f00eff7.tar.bz2
Fixes #4239 rerun corrected blog status upgrade
Diffstat (limited to 'engine/lib/upgrades')
-rw-r--r--engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php25
1 files changed, 25 insertions, 0 deletions
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
index 000000000..e351c6ac9
--- /dev/null
+++ b/engine/lib/upgrades/2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php
@@ -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