2014111600-1.9.4-recheck_comments_upgrade-9da270072a5b0cad.php 886 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Elgg 1.9.4 upgrade 2014111600
  4. * recheck_comments_upgrade
  5. *
  6. * The discussion reply upgrade had a bug that caused it to mark also the
  7. * comments upgrade as completed. This rechecks whether there still are
  8. * unmigrated comment annotations left and marks the upgrade as incomplete
  9. * if annotations are found.
  10. */
  11. $access_status = access_get_show_hidden_status();
  12. access_show_hidden_entities(true);
  13. $ia = elgg_set_ignore_access(true);
  14. $comments = elgg_get_annotations(array(
  15. 'annotation_names' => 'generic_comment',
  16. 'count' => true
  17. ));
  18. if ($comments) {
  19. $factory = new ElggUpgrade();
  20. $upgrade = $factory->getUpgradeFromPath("admin/upgrades/comments");
  21. if ($upgrade) {
  22. $upgrade->setPrivateSetting('is_completed', 0);
  23. _elgg_create_notice_of_pending_upgrade(null, null, $upgrade);
  24. }
  25. }
  26. elgg_set_ignore_access($ia);
  27. access_show_hidden_entities($access_status);