2011123101-1.8.2-fix_blog_status-b14c2a0e7b9e7d55.php 607 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * Elgg 1.8.2 upgrade 2011123101
  4. * fix_blog_status
  5. *
  6. * Most blog posts did not have their status properly set with 1.8 upgrade so we run
  7. * the blog status upgrade again
  8. */
  9. $ia = elgg_set_ignore_access(true);
  10. $options = array(
  11. 'type' => 'object',
  12. 'subtype' => 'blog',
  13. 'limit' => 0,
  14. );
  15. $batch = new \ElggBatch('elgg_get_entities', $options);
  16. foreach ($batch as $entity) {
  17. if (!$entity->status) {
  18. // create metadata owned by the original owner
  19. create_metadata($entity->getGUID(), 'status', 'published', '', $entity->owner_guid,
  20. $entity->access_id);
  21. }
  22. }
  23. elgg_set_ignore_access($ia);