update: add option to send digests

master
Andrew Dolgov 5 years ago
parent 6ae0a3dd3e
commit 3bd3324e5a

@ -697,17 +697,17 @@ class Article extends Handler_Protected {
$ids_qmarks = arr_qmarks($ids); $ids_qmarks = arr_qmarks($ids);
if ($cmode == 0) { if ($cmode == 1) {
$sth = $pdo->prepare("UPDATE ttrss_user_entries SET $sth = $pdo->prepare("UPDATE ttrss_user_entries SET
unread = false,last_read = NOW() unread = true
WHERE ref_id IN ($ids_qmarks) AND owner_uid = ?"); WHERE ref_id IN ($ids_qmarks) AND owner_uid = ?");
} else if ($cmode == 1) { } else if ($cmode == 2) {
$sth = $pdo->prepare("UPDATE ttrss_user_entries SET $sth = $pdo->prepare("UPDATE ttrss_user_entries SET
unread = true unread = NOT unread,last_read = NOW()
WHERE ref_id IN ($ids_qmarks) AND owner_uid = ?"); WHERE ref_id IN ($ids_qmarks) AND owner_uid = ?");
} else { } else {
$sth = $pdo->prepare("UPDATE ttrss_user_entries SET $sth = $pdo->prepare("UPDATE ttrss_user_entries SET
unread = NOT unread,last_read = NOW() unread = false,last_read = NOW()
WHERE ref_id IN ($ids_qmarks) AND owner_uid = ?"); WHERE ref_id IN ($ids_qmarks) AND owner_uid = ?");
} }

@ -287,7 +287,7 @@ class RPC extends Handler_Protected {
/* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */ /* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */
function catchupSelected() { function catchupSelected() {
$ids = explode(",", clean($_REQUEST["ids"])); $ids = explode(",", clean($_REQUEST["ids"]));
$cmode = sprintf("%d", clean($_REQUEST["cmode"])); $cmode = (int)clean($_REQUEST["cmode"]);
Article::catchupArticlesById($ids, $cmode); Article::catchupArticlesById($ids, $cmode);

@ -24,6 +24,7 @@
$longopts = array("feeds", $longopts = array("feeds",
"daemon", "daemon",
"daemon-loop", "daemon-loop",
"send-digests",
"task:", "task:",
"cleanup-tags", "cleanup-tags",
"quiet", "quiet",
@ -87,6 +88,7 @@
print " --update-schema - update database schema\n"; print " --update-schema - update database schema\n";
print " --gen-search-idx - generate basic PostgreSQL fulltext search index\n"; print " --gen-search-idx - generate basic PostgreSQL fulltext search index\n";
print " --convert-filters - convert type1 filters to type2\n"; print " --convert-filters - convert type1 filters to type2\n";
print " --send-digests - send pending email digests\n";
print " --force-update - force update of all feeds\n"; print " --force-update - force update of all feeds\n";
print " --list-plugins - list all available plugins\n"; print " --list-plugins - list all available plugins\n";
print " --debug-feed N - perform debug update of feed N\n"; print " --debug-feed N - perform debug update of feed N\n";
@ -432,6 +434,10 @@
exit($rc); exit($rc);
} }
if (isset($options["send-digests"])) {
Digest::send_headlines_digests();
}
PluginHost::getInstance()->run_commands($options); PluginHost::getInstance()->run_commands($options);
if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) if (file_exists(LOCK_DIRECTORY . "/$lock_filename"))

Loading…
Cancel
Save