]> git.wh0rd.org Git - tt-rss.git/commitdiff
implement schedule insert handlers
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 11 Feb 2006 14:56:10 +0000 (15:56 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 11 Feb 2006 14:56:10 +0000 (15:56 +0100)
backend.php

index 4401b259ca38ee74eee38fdccbd663c6bfb38cc2..8c988ae955ba9970e587c5798c11163888a2de3b 100644 (file)
        
                        if (ENABLE_UPDATE_SCHEDULER) {
 
-                               // FIXME schedule new update entry (with rate limit check)
+                               $result = db_query($link, "SELECT count(id) AS cid FROM
+                                       ttrss_scheduled_updates WHERE feed_id IS NULL AND
+                                               owner_uid = " . $_SESSION["uid"]);
+
+                               $cid = db_fetch_result($result, 0, "cid");
+
+                               print "<rpc-reply>";
+
+                               if ($cid == 0) {
+
+                                       db_query($link, "INSERT INTO ttrss_scheduled_updates
+                                               (owner_uid, feed_id, entered) VALUES
+                                               (".$_SESSION["uid"].", NULL, NOW())");
+                                               
+                                       print "<message>ScheduledOK</message>";
+                                       
+                               } else {
+                                       print "<message>RequestAlreadyInQueue</message>";
+                               }
+
+                               print "</rpc-reply>";
                                
                        } else {        
                                update_all_feeds($link, $subop == "forceUpdateAllFeeds");
                if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
 
                        if (ENABLE_UPDATE_SCHEDULER) {
-                               // FIXME Schedule new feed entry for updating (w/rate limiting)
+
+                               if ($cid == 0) {
+
+                                       db_query($link, "INSERT INTO ttrss_scheduled_updates
+                                               (owner_uid, feed_id, entered) VALUES
+                                               (".$_SESSION["uid"].", '$feed', NOW())");
+                               }
 
                        } else {
                                $tmp_result = db_query($link, "SELECT feed_url FROM ttrss_feeds