]> git.wh0rd.org Git - tt-rss.git/commitdiff
use join between user_entries and entries table
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 11 Aug 2015 17:04:38 +0000 (20:04 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 11 Aug 2015 17:04:38 +0000 (20:04 +0300)
include/functions2.php

index 781cd067f0f852bdf6cb7038c07134d50731b9e3..6ccdc9a58b933329c606f6863c23a742e025a57c 100644 (file)
                                } else {
                                        $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
 
-                                       $ext_tables_part = ",ttrss_labels2,ttrss_user_labels2";
+                                       $ext_tables_part = "ttrss_labels2,ttrss_user_labels2,";
 
                                        $query_strategy_part = "ttrss_labels2.id = ttrss_user_labels2.label_id AND
                                                ttrss_user_labels2.article_id = ref_id";
                                        ttrss_user_labels2.article_id = ref_id";
 
                                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
-                               $ext_tables_part = ",ttrss_labels2,ttrss_user_labels2";
+                               $ext_tables_part = "ttrss_labels2,ttrss_user_labels2,";
                                $allow_archived = true;
 
                        } else {
                                }
 
                                if (!$allow_archived) {
-                                       $from_qpart = "ttrss_entries,ttrss_user_entries,ttrss_feeds$ext_tables_part";
+                                       $from_qpart = "${ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id),ttrss_feeds";
                                        $feed_check_qpart = "ttrss_user_entries.feed_id = ttrss_feeds.id AND";
 
                                } else {
-                                       $from_qpart = "ttrss_entries$ext_tables_part,ttrss_user_entries
+                                       $from_qpart = "${ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id)
                                                LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)";
                                }
 
                                                        $from_qpart
                                                WHERE
                                                $feed_check_qpart
-                                               ttrss_user_entries.ref_id = ttrss_entries.id AND
                                                ttrss_user_entries.owner_uid = '$owner_uid' AND
                                                $search_query_part
                                                $start_ts_query_part
                                                $from_qpart
                                        WHERE
                                        $feed_check_qpart
-                                       ttrss_user_entries.ref_id = ttrss_entries.id AND
                                        ttrss_user_entries.owner_uid = '$owner_uid' AND
                                        $search_query_part
                                        $start_ts_query_part