offline: sync marked/unread status (performance tweak)

master
Andrew Dolgov 16 years ago
parent 492a4a6ac8
commit 5b8444d371

@ -545,27 +545,22 @@
$id = (int) $e[0]; $id = (int) $e[0];
$unread = bool_to_sql_bool((bool) $e[1]); $unread = bool_to_sql_bool((bool) $e[1]);
$marked = bool_to_sql_bool((bool) $e[2]); $marked = (bool)$e[2];
$query = "UPDATE ttrss_user_entries SET
unread = $unread,
last_read = '$last_online'
WHERE ref_id = '$id' AND
(last_read IS NULL OR last_read < '$last_online') AND
owner_uid = ".$_SESSION["uid"];
$result = db_query($link, $query);
if ($marked) { if ($marked) {
$marked = bool_to_sql_bool($marked);
$marked_qpart = "marked = $marked,";
}
$query = "UPDATE ttrss_user_entries SET $query = "UPDATE ttrss_user_entries SET
marked = $marked, $marked_qpart
unread = $unread,
last_read = '$last_online' last_read = '$last_online'
WHERE ref_id = '$id' AND WHERE ref_id = '$id' AND
(last_read IS NULL OR last_read < '$last_online') AND (last_read IS NULL OR last_read < '$last_online') AND
owner_uid = ".$_SESSION["uid"]; owner_uid = ".$_SESSION["uid"];
$result = db_query($link, $query); $result = db_query($link, $query);
}
print "<sync-ok id=\"$id\"/>"; print "<sync-ok id=\"$id\"/>";

Loading…
Cancel
Save