2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php 730 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Elgg 1.8b1 upgrade 2011061200
  4. * sites_need_a_site_guid
  5. *
  6. * Sites did not have a site guid. This causes problems with getting
  7. * metadata on site objects since we default to the current site.
  8. */
  9. global $CONFIG;
  10. $ia = elgg_set_ignore_access(true);
  11. $access_status = access_get_show_hidden_status();
  12. access_show_hidden_entities(true);
  13. $options = array(
  14. 'type' => 'site',
  15. 'site_guid' => 0,
  16. 'limit' => 0,
  17. );
  18. $batch = new \ElggBatch('elgg_get_entities', $options);
  19. foreach ($batch as $entity) {
  20. if (!$entity->site_guid) {
  21. update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid=$entity->guid
  22. WHERE guid=$entity->guid");
  23. }
  24. }
  25. access_show_hidden_entities($access_status);
  26. elgg_set_ignore_access($ia);