]> git.wh0rd.org - tt-rss.git/blobdiff - functions.php
simplepie: enable https and digest auth
[tt-rss.git] / functions.php
index 919cd926cfadc54af8776b222723cdd86ca03673..5ab98829c0a9f2f41866d3e11f4e5de1c1f69351 100644 (file)
@@ -77,6 +77,7 @@
 
        function _debug($msg) {
                $ts = strftime("%H:%M:%S", time());
+               $ts = "$ts/" . posix_getpid();
                print "[$ts] $msg\n";
        }
 
                        _debug("update_rss_feed: start");
                }
 
-               $result = db_query($link, "SELECT id,update_interval,auth_login,auth_pass,cache_images
-                       FROM ttrss_feeds WHERE id = '$feed'");
+               if (!$ignore_daemon) {
+
+                       if (DB_TYPE == "pgsql") {
+                                       $updstart_thresh_qpart = "(ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < NOW() - INTERVAL '120 seconds')";
+                               } else {
+                                       $updstart_thresh_qpart = "(ttrss_feeds.last_update_started IS NULL OR ttrss_feeds.last_update_started < DATE_SUB(NOW(), INTERVAL 120 SECOND))";
+                               }                       
+       
+                       $result = db_query($link, "SELECT id,update_interval,auth_login,
+                               auth_pass,cache_images
+                               FROM ttrss_feeds WHERE id = '$feed' AND $updstart_thresh_qpart");
+
+               } else {
+
+                       $result = db_query($link, "SELECT id,update_interval,auth_login,
+                               auth_pass,cache_images
+                               FROM ttrss_feeds WHERE id = '$feed'");
+
+               }
 
                if (db_num_rows($result) == 0) {
                        if (defined('DAEMON_EXTENDED_DEBUG') || $_GET['xdebug']) {
-                               _debug("update_rss_feed: feed $feed [$feed_url] NOT FOUND");
+                               _debug("update_rss_feed: feed $feed [$feed_url] NOT FOUND/SKIPPED");
                        }               
                        return;
                }
                                }
        
                                printFeedEntry($feed_id, $class, $feed, $unread, 
-                                       ICONS_DIR."/$feed_id.ico", $link, $rtl_content, 
+                                       ICONS_URL."/$feed_id.ico", $link, $rtl_content, 
                                        $last_updated, $line["last_error"]);
        
                                ++$lnum;