]> git.wh0rd.org - tt-rss.git/commitdiff
try to send digests within 2 hours of preferred time only
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 31 Jan 2012 11:52:33 +0000 (15:52 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 31 Jan 2012 11:52:33 +0000 (15:52 +0400)
classes/pref_prefs.php
include/functions.php

index 78c66124a42a6bce0f4657dd25fee05795ef9d28..c8843adae17036e9864888e7d7bd81903595ab9a 100644 (file)
@@ -78,6 +78,15 @@ class Pref_Prefs extends Protected_Handler {
                        $pref_name = db_escape_string($pref_name);
                        $value = db_escape_string($_POST[$pref_name]);
 
+                       if ($pref_name == 'DIGEST_PREFERRED_TIME') {
+                               if (get_pref($this->link, 'DIGEST_PREFERRED_TIME') != $value) {
+
+                                       db_query($this->link, "UPDATE ttrss_users SET
+                                               last_digest_sent = NULL WHERE id = " . $_SESSION['uid']);
+
+                               }
+                       }
+
                        set_pref($this->link, $pref_name, $value);
 
                }
index 9eb66de3ea3fcd3d5637b0e450f1da55a19b465a..0ef1d013fe7b4a5f086eec7600eca38af90f49d4 100644 (file)
                        if (get_pref($link, 'DIGEST_ENABLE', $line['id'], false)) {
                                $preferred_ts = strtotime(get_pref($link, 'DIGEST_PREFERRED_TIME', $line['id'], '00:00'));
 
-                               if ($preferred_ts && time() >= $preferred_ts) {
+                               // try to send digests within 2 hours of preferred time
+                               if ($preferred_ts && time() >= $preferred_ts &&
+                                               time() - $preferred_ts <= 7200) {
 
                                        if ($debug) print "Sending digest for UID:" . $line['id'] . " - " . $line["email"] . " ... ";