summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-01-16 12:06:42 +0100
committerAndrew Dolgov <[email protected]>2009-01-16 12:06:42 +0100
commite3b5469373d81134d2752f5bcaa08460961f3676 (patch)
tree1f1406c9cf7e86bfe6e9f373cc63e4c3351c3ced
parent6c8feb8f1264469b30c7f57e2e98165ece5e5c3e (diff)
regenerate feedbrowser cache from the update daemon
-rw-r--r--update_daemon2.php11
-rw-r--r--update_daemon_loop.php34
-rw-r--r--update_feedbrowser.php8
3 files changed, 20 insertions, 33 deletions
diff --git a/update_daemon2.php b/update_daemon2.php
index 08f5d74c3..a85bc1f52 100644
--- a/update_daemon2.php
+++ b/update_daemon2.php
@@ -174,8 +174,15 @@
// $last_purge = time();
// }
- // Call to the feed batch update function
- update_daemon_common($link);
+ // Call to the feed batch update function
+ // or regenerate feedbrowser cache
+
+ if (rand(0,100) > 50) {
+ update_daemon_common($link);
+ } else {
+ $count = update_feedbrowser_cache($link);
+ _debug("Finished, $count feeds processed.");
+ }
_debug("Elapsed time: " . (time() - $start_timestamp) . " second(s)");
diff --git a/update_daemon_loop.php b/update_daemon_loop.php
index b1197ff34..c82ee561b 100644
--- a/update_daemon_loop.php
+++ b/update_daemon_loop.php
@@ -69,36 +69,16 @@
$last_purge = time();
}
- // FIXME: get all scheduled updates w/forced refetch
- // Stub, until I figure out if it is really needed.
+ // Call to the feed batch update function
+ // or regenerate feedbrowser cache
-# $result = db_query($link, "SELECT * FROM ttrss_scheduled_updates ORDER BY id");
-# while ($line = db_fetch_assoc($result)) {
-# print "Scheduled feed update: " . $line["feed_id"] . ", UID: " .
-# $line["owner_uid"] . "\n";
-# }
-
- // Process all other feeds using last_updated and interval parameters
-
-// $random_qpart = sql_random_function();
-
-/*
- ttrss_entries.date_entered < NOW() - INTERVAL '$purge_interval days'");
- }
-
- $rows = pg_affected_rows($result);
-
+ if (rand(0,100) > 50) {
+ update_daemon_common($link);
} else {
+ $count = update_feedbrowser_cache($link);
+ print "Finished, $count feeds processed.\n";
+ }
- $result = db_query($link, "DELETE FROM ttrss_user_entries
- USING ttrss_user_entries, ttrss_entries
- WHERE ttrss_entries.id = ref_id AND
- marked = false AND
- feed_id = '$feed_id' AND
- ttrss_entries.date_entered < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)"); */
-
- // Call to the feed batch update function
- update_daemon_common($link);
db_close($link);
diff --git a/update_feedbrowser.php b/update_feedbrowser.php
index 4698918d5..0031ff315 100644
--- a/update_feedbrowser.php
+++ b/update_feedbrowser.php
@@ -1,9 +1,9 @@
#!/usr/bin/php
<?php
- // this script is probably run not from your httpd-user, so cache
- // directory defined in config.php won't be accessible
- define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache-cli');
- define('SIMPLEPIE_CACHE_DIR', '/var/tmp/simplepie-ttrss-cache-cli');
+ /* This script updates feedbrowser (e.g. Other Feeds tab) cache
+ * If you are using update daemon, it is NOT necessary to run
+ * this script, as updates are handled automatically. */
+
define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
define('DISABLE_SESSIONS', true);