optimize catchup selected, add CatchupSelected subop in viewfeed
This commit is contained in:
parent
39ddbaa1c4
commit
472782e8bf
|
@ -149,25 +149,10 @@
|
||||||
if ($subop == "catchupSelected") {
|
if ($subop == "catchupSelected") {
|
||||||
|
|
||||||
$ids = split(",", db_escape_string($_GET["ids"]));
|
$ids = split(",", db_escape_string($_GET["ids"]));
|
||||||
|
|
||||||
$cmode = sprintf("%d", $_GET["cmode"]);
|
$cmode = sprintf("%d", $_GET["cmode"]);
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
catchupArticlesById($link, $ids, $cmode);
|
||||||
|
|
||||||
if ($cmode == 0) {
|
|
||||||
db_query($link, "UPDATE ttrss_user_entries SET
|
|
||||||
unread = false,last_read = NOW()
|
|
||||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
|
||||||
} else if ($cmode == 1) {
|
|
||||||
db_query($link, "UPDATE ttrss_user_entries SET
|
|
||||||
unread = true
|
|
||||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
|
||||||
} else {
|
|
||||||
db_query($link, "UPDATE ttrss_user_entries SET
|
|
||||||
unread = NOT unread,last_read = NOW()
|
|
||||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "<rpc-reply>";
|
print "<rpc-reply>";
|
||||||
print "<counters>";
|
print "<counters>";
|
||||||
getAllCounters($link);
|
getAllCounters($link);
|
||||||
|
|
|
@ -696,6 +696,13 @@
|
||||||
type=\"text/css\" href=\"tt-rss_compact.css\"/>";
|
type=\"text/css\" href=\"tt-rss_compact.css\"/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subop == "CatchupSelected") {
|
||||||
|
$ids = split(",", db_escape_string($_GET["ids"]));
|
||||||
|
$cmode = sprintf("%d", $_GET["cmode"]);
|
||||||
|
|
||||||
|
catchupArticlesById($link, $ids, $cmode);
|
||||||
|
}
|
||||||
|
|
||||||
if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
|
if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
|
||||||
update_generic_feed($link, $feed, $cat_view);
|
update_generic_feed($link, $feed, $cat_view);
|
||||||
}
|
}
|
||||||
|
|
2
db.php
2
db.php
|
@ -61,7 +61,7 @@ function db_query($link, $query, $die_on_error = true) {
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$query = htmlspecialchars($query); // just in case
|
$query = htmlspecialchars($query); // just in case
|
||||||
if ($die_on_error) {
|
if ($die_on_error) {
|
||||||
die("Query <i>$query</i> failed: " . pg_last_error($link));
|
die("Query <i>$query</i> failed [$result]: " . pg_last_error($link));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -2586,4 +2586,30 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function catchupArticlesById($link, $ids, $cmode) {
|
||||||
|
|
||||||
|
$tmp_ids = array();
|
||||||
|
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
array_push($tmp_ids, "ref_id = '$id'");
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids_qpart = join(" OR ", $tmp_ids);
|
||||||
|
|
||||||
|
if ($cmode == 0) {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries SET
|
||||||
|
unread = false,last_read = NOW()
|
||||||
|
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
} else if ($cmode == 1) {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries SET
|
||||||
|
unread = true
|
||||||
|
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
} else {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries SET
|
||||||
|
unread = NOT unread,last_read = NOW()
|
||||||
|
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue