aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-08 03:20:34 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-08 03:20:34 +0000
commite71b5221f3896f6ddacdda5e0df406a8ce058c46 (patch)
tree78e0eecb3f3750b844d55b090c2dbffd5ccd328e /engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php
parent1900eedee2f8d2fa729a01293238c2ad85fb4147 (diff)
downloadelgg-e71b5221f3896f6ddacdda5e0df406a8ce058c46.tar.gz
elgg-e71b5221f3896f6ddacdda5e0df406a8ce058c46.tar.bz2
Fixes #2229. Removed published data metadata in blog. Added upgrade to set all status metadata for old blog posts.
git-svn-id: http://code.elgg.org/elgg/trunk@8626 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php')
-rw-r--r--engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php b/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php
new file mode 100644
index 000000000..e4ab9c137
--- /dev/null
+++ b/engine/lib/upgrades/2011030700-1.8_svn-blog_status_metadata-4645225d7b440876.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Elgg 1.8-svn upgrade 2011030700
+ * blog_status_metadata
+ *
+ * Add a "status" metadata entry to every blog entity because in 1.8 you can have status = draft or
+ * status = published
+ */
+$ia = elgg_set_ignore_access(true);
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'blog'
+);
+$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