aboutsummaryrefslogtreecommitdiff
path: root/upgrades/2012020901.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2012-07-13 22:23:52 -0400
committerCash Costello <cash.costello@gmail.com>2012-07-13 22:23:52 -0400
commit54bc5844dfe6cb684c7aecaf1be5ee8071d98fe0 (patch)
tree90f4166d6cd605eb4d7e95d63682732a1c5476a5 /upgrades/2012020901.php
parent695651451b262c526d6aaf9d0988ce557ff50e95 (diff)
parent894ea6758f3f99c49807df99ef4bbd95f74273dc (diff)
downloadelgg-54bc5844dfe6cb684c7aecaf1be5ee8071d98fe0.tar.gz
elgg-54bc5844dfe6cb684c7aecaf1be5ee8071d98fe0.tar.bz2
Merged notifications update from Brett's fork
Diffstat (limited to 'upgrades/2012020901.php')
-rw-r--r--upgrades/2012020901.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/upgrades/2012020901.php b/upgrades/2012020901.php
new file mode 100644
index 000000000..793279b38
--- /dev/null
+++ b/upgrades/2012020901.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Adds last notified metadata and sets the notify interval
+ */
+
+elgg_set_plugin_setting('notify_interval', 60 * 60 * 24, 'tidypics');
+
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'album',
+ 'limit' => 0
+);
+
+$prefix = elgg_get_config('dbprefix');
+$batch = new ElggBatch('elgg_get_entities', $options);
+
+foreach ($batch as $album) {
+ // grab earliest picture and use that as the notification time
+ // in old version of tidypics notifications went out only when a new album was populated.
+ $q = "SELECT MIN(time_created) as ts FROM {$prefix}entities WHERE container_guid = $album->guid";
+ $row = get_data_row($q);
+
+ if ($row) {
+ $album->last_notified = $row->ts;
+ }
+}