1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-18 04:01:54 +00:00

command globalUpdateFeeds to update feeds of all users at once

This commit is contained in:
Andrew Dolgov
2005-11-21 08:11:21 +01:00
parent 4585ff0eab
commit a277007718
4 changed files with 45 additions and 28 deletions

View File

@@ -82,11 +82,16 @@
(SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0");
}
function update_all_feeds($link, $fetch) {
function update_all_feeds($link, $fetch, $user_id = false) {
if (WEB_DEMO_MODE) return;
if (get_pref($link, 'DAEMON_REFRESH_ONLY')) {
if (!$user_id) {
$user_id = $_SESSION["uid"];
purge_old_posts($link);
}
if (get_pref($link, 'DAEMON_REFRESH_ONLY', $user_id)) {
if (!$_GET["daemon"]) {
return;
}
@@ -94,8 +99,6 @@
db_query($link, "BEGIN");
$user_id = $_SESSION["uid"];
$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'");
@@ -104,7 +107,7 @@
$upd_intl = $line["update_interval"];
if (!$upd_intl || $upd_intl == 0) {
$upd_intl = get_pref($link, 'DEFAULT_UPDATE_INTERVAL');
$upd_intl = get_pref($link, 'DEFAULT_UPDATE_INTERVAL', $user_id);
}
if ($fetch || (!$line["last_updated"] ||
@@ -114,8 +117,6 @@
}
}
purge_old_posts($link);
db_query($link, "COMMIT");
}
@@ -176,10 +177,6 @@
if ($rss) {
if (get_pref($link, 'ENABLE_FEED_ICONS')) {
check_feed_favicon($feed_url, $feed, $link);
}
$result = db_query($link, "SELECT title,icon_url,site_url,owner_uid
FROM ttrss_feeds WHERE id = '$feed'");
@@ -189,6 +186,10 @@
$owner_uid = db_fetch_result($result, 0, "owner_uid");
if (get_pref($link, 'ENABLE_FEED_ICONS', $owner_uid)) {
check_feed_favicon($feed_url, $feed, $link);
}
if (!$registered_title) {
$feed_title = db_escape_string($rss->channel["title"]);
db_query($link, "UPDATE ttrss_feeds SET
@@ -343,7 +344,7 @@
// check for user post link to main table
// do we allow duplicate posts with same GUID in different feeds?
if (get_pref($link, "ALLOW_DUPLICATE_POSTS")) {
if (get_pref($link, "ALLOW_DUPLICATE_POSTS", $owner_uid)) {
$dupcheck_qpart = "AND feed_id = '$feed'";
} else {
$dupcheck_qpart = "";
@@ -364,7 +365,7 @@
$post_needs_update = false;
if (get_pref($link, "UPDATE_POST_ON_CHECKSUM_CHANGE") &&
if (get_pref($link, "UPDATE_POST_ON_CHECKSUM_CHANGE", $owner_uid) &&
($content_hash != $orig_content_hash)) {
$post_needs_update = true;
}