summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-02-11 05:47:52 +0100
committerAndrew Dolgov <[email protected]>2006-02-11 05:47:52 +0100
commitcbd8650dfe0edd0a2eecd99b78cda80c61cd123d (patch)
treeb1bec1f1c631e6fada252461ce0fc56c4bb58c90 /functions.php
parente2cb4c6d7a4781469798fd5cf66ddb72e5d4a57c (diff)
new option: MAX_UPDATE_TIME
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/functions.php b/functions.php
index 536f5d66d..2e25b9500 100644
--- a/functions.php
+++ b/functions.php
@@ -101,10 +101,22 @@
// db_query($link, "BEGIN");
+ if (MAX_UPDATE_TIME > 0) {
+ if (DB_TYPE == "mysql") {
+ $q_order = "RAND()";
+ } else {
+ $q_order = "RANDOM()";
+ }
+ } else {
+ $q_order = "last_updated DESC";
+ }
+
$result = db_query($link, "SELECT feed_url,id,
SUBSTRING(last_updated,1,19) AS last_updated,
update_interval FROM ttrss_feeds WHERE owner_uid = '$user_id'
- ORDER BY last_updated DESC");
+ ORDER BY $q_order");
+
+ $upd_start = time();
while ($line = db_fetch_assoc($result)) {
$upd_intl = $line["update_interval"];
@@ -116,7 +128,15 @@
if ($fetch || (!$line["last_updated"] ||
time() - strtotime($line["last_updated"]) > ($upd_intl * 60))) {
+// print "<!-- feed: ".$line["feed_url"]." -->";
+
update_rss_feed($link, $line["feed_url"], $line["id"], $force_daemon);
+
+ $upd_elapsed = time() - $upd_start;
+
+ if (MAX_UPDATE_TIME > 0 && $upd_elapsed > MAX_UPDATE_TIME) {
+ return;
+ }
}
}