]> git.wh0rd.org Git - tt-rss.git/commitdiff
daemons: fix feed select query for PGSQL
authorAndrew Dolgov <fox@bah.spb.su>
Thu, 24 Jan 2008 17:54:36 +0000 (18:54 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Thu, 24 Jan 2008 17:54:36 +0000 (18:54 +0100)
update_daemon2.php
update_daemon_loop.php

index cf25eeac205e0ede4ef5c1388369b444b15c4778..315daa7e0d215605aec83373c7db0cd8e6c1569d 100644 (file)
                                                $login_thresh_qpart = "";
                                        }
 
-                                       //if (DB_TYPE == "pgsql") {
-                                       //      $update_limit_qpart = "AND ttrss_feeds.last_updated < NOW() - INTERVAL '".(DAEMON_SLEEP_INTERVAL*2)." seconds'";
-                                       //} else {
-                                       //      $update_limit_qpart = "AND ttrss_feeds.last_updated < DATE_SUB(NOW(), INTERVAL ".(DAEMON_SLEEP_INTERVAL*2)." SECOND)";
-                                       //}
-
                                        if (DB_TYPE == "pgsql") {
-                                               $update_limit_qpart = "AND ttrss_feeds.last_updated < NOW() - INTERVAL '".(DAEMON_SLEEP_INTERVAL*2)." seconds'";
                                                $update_limit_qpart = "AND ((
                                                                ttrss_feeds.update_interval = 0
-                                                               AND ttrss_feeds.last_updated < NOW() - INTERVAL ttrss_user_prefs.value || ' minutes'
+                                                               AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL)
                                                        ) OR (
                                                                ttrss_feeds.update_interval > 0
-                                                               AND ttrss_feeds.last_updated < NOW() - INTERVAL ttrss_feeds.update_interval || ' minutes'
+                                                               AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL)
                                                        ))";
                                        } else {
                                                $update_limit_qpart = "AND ((
                                                WHERE
                                                        ttrss_feeds.owner_uid = ttrss_users.id
                                                        AND ttrss_users.id = ttrss_user_prefs.owner_uid
-                                                       AND ttrss_user_prefs.pref_name='DEFAULT_UPDATE_INTERVAL'
+                                                       AND ttrss_user_prefs.pref_name = 'DEFAULT_UPDATE_INTERVAL'
                                                        $login_thresh_qpart $update_limit_qpart
                                                         $updstart_thresh_qpart
                                                ORDER BY $random_qpart DESC LIMIT " . DAEMON_FEED_LIMIT);
index 08fad1b976c068137f3572fcf01f82ec20541650..4c13dedce512cc2e1119c153d11d8a0164841c4c 100644 (file)
        }
 
        if (DB_TYPE == "pgsql") {
-               $update_limit_qpart = "AND ttrss_feeds.last_updated < NOW() - INTERVAL '".(DAEMON_SLEEP_INTERVAL*2)." seconds'";
                $update_limit_qpart = "AND ((
                                ttrss_feeds.update_interval = 0
-                               AND ttrss_feeds.last_updated < NOW() - INTERVAL ttrss_user_prefs.value || ' minutes'
+                               AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_user_prefs.value || ' minutes') AS INTERVAL)
                        ) OR (
                                ttrss_feeds.update_interval > 0
-                               AND ttrss_feeds.last_updated < NOW() - INTERVAL ttrss_feeds.update_interval || ' minutes'
+                               AND ttrss_feeds.last_updated < NOW() - CAST((ttrss_feeds.update_interval || ' minutes') AS INTERVAL)
                        ))";
        } else {
                $update_limit_qpart = "AND ((