]> git.wh0rd.org Git - tt-rss.git/commitdiff
offline: sync marked/unread status (performance tweak)
authorAndrew Dolgov <fox@bah.org.ru>
Tue, 17 Feb 2009 09:30:54 +0000 (12:30 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Tue, 17 Feb 2009 09:30:54 +0000 (12:30 +0300)
modules/backend-rpc.php

index d7700d66a3b1c84de57b940e9a344c084dd3a0a6..afcd82d3f591dc37304c0219f2780b24610a7395 100644 (file)
 
                                                        $id = (int) $e[0];
                                                        $unread = bool_to_sql_bool((bool) $e[1]);
-                                                       $marked = bool_to_sql_bool((bool) $e[2]);
+                                                       $marked = (bool)$e[2];
+
+                                                       if ($marked) {
+                                                               $marked = bool_to_sql_bool($marked);
+                                                               $marked_qpart = "marked = $marked,";
+                                                       }
 
                                                        $query = "UPDATE ttrss_user_entries SET 
+                                                               $marked_qpart
                                                                unread = $unread, 
                                                                last_read = '$last_online' 
                                                        WHERE ref_id = '$id' AND 
 
                                                        $result = db_query($link, $query);
 
-                                                       if ($marked) {
-                                                               $query = "UPDATE ttrss_user_entries SET 
-                                                                       marked = $marked, 
-                                                                       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);
-                                                       }
-
                                                        print "<sync-ok id=\"$id\"/>";
 
                                                }