From: Andrew Dolgov Date: Sat, 11 Feb 2006 14:56:10 +0000 (+0100) Subject: implement schedule insert handlers X-Git-Tag: 1.1.3~45 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=8b9112513ed380cf96262a32dd494c4ceef35486;p=tt-rss.git implement schedule insert handlers --- diff --git a/backend.php b/backend.php index 4401b259..8c988ae9 100644 --- a/backend.php +++ b/backend.php @@ -705,7 +705,27 @@ 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 ""; + + if ($cid == 0) { + + db_query($link, "INSERT INTO ttrss_scheduled_updates + (owner_uid, feed_id, entered) VALUES + (".$_SESSION["uid"].", NULL, NOW())"); + + print "ScheduledOK"; + + } else { + print "RequestAlreadyInQueue"; + } + + print ""; } else { update_all_feeds($link, $subop == "forceUpdateAllFeeds"); @@ -1017,7 +1037,13 @@ 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