2012020901.php 685 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Adds last notified metadata and sets the notify interval
  4. */
  5. elgg_set_plugin_setting('notify_interval', 60 * 60 * 24, 'tidypics');
  6. $options = array(
  7. 'type' => 'object',
  8. 'subtype' => 'album',
  9. 'limit' => 0
  10. );
  11. $prefix = elgg_get_config('dbprefix');
  12. $batch = new ElggBatch('elgg_get_entities', $options);
  13. foreach ($batch as $album) {
  14. // grab earliest picture and use that as the notification time
  15. // in old version of tidypics notifications went out only when a new album was populated.
  16. $q = "SELECT MIN(time_created) as ts FROM {$prefix}entities WHERE container_guid = $album->guid";
  17. $row = get_data_row($q);
  18. if ($row) {
  19. $album->last_notified = $row->ts;
  20. }
  21. }