]> git.wh0rd.org - tt-rss.git/commitdiff
remove config option SMART_RPC_COUNTERS
authorAndrew Dolgov <fox@bah.org.ru>
Fri, 15 Jan 2010 14:34:17 +0000 (17:34 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Fri, 15 Jan 2010 14:34:17 +0000 (17:34 +0300)
api/index.php
config.php-dist
functions.php
utils/xml-rpc.php

index 9d1a962dcb1e7d985894114b99d2ff22c3cbcf36..60753e9caefa28c4bc53b3b00f0937832d806232 100644 (file)
                        /* Labels */
 
                        if (!$cat_id || $cat_id == -2) {
-                               $counters = getLabelCounters($link, false, true);
+                               $counters = getLabelCounters($link, true);
 
                                foreach (array_keys($counters) as $id) {
 
index af0b7923d618498ef68ceccb78dae43f53a4c036..85fe7cdc4ec2d1cfd6a861a9a5bdcd959abaf7b0 100644 (file)
        // Operate in single user mode, disables all functionality related to
        // multiple users.
        
-       define('SMART_RPC_COUNTERS', false);
-       // If enabled, stores feed counter information on the server side and sends
-       // only diffs to the client. In the nutshell, it saves your bandwidth and
-       // makes UI more responsive, but eats server memory.
-       // This option can introduce a lot of weird interface glitches in
-       // some use-cases (if you have more than one tt-rss window open, for example)
-       // so it is disabled by default.
-
        define('ENABLE_FEED_BROWSER', true);
        // Enable or disable local feed browser
 
index 781074569a16b1c325c45f15b9b03b63a52f1308..161335c96536d128dc596235f7b96d9b3ca36428 100644 (file)
                getVirtCounters($link);
 
                if (strchr($omode, "l")) getLabelCounters($link);
-               if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed);
+               if (strchr($omode, "f")) getFeedCounters($link, $active_feed);
                if (strchr($omode, "t")) getTagCounters($link);
                if (strchr($omode, "c")) {                      
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                return db_fetch_result($result, 0, "fn");
        }
 
-       function getTagCounters($link, $smart_mode = SMART_RPC_COUNTERS) {
-
-               if ($smart_mode) {
-                       if (!$_SESSION["tctr_last_value"]) {
-                               $_SESSION["tctr_last_value"] = array();
-                       }
-               }
-
-               $old_counters = $_SESSION["tctr_last_value"];
-
-               $tctrs_modified = false;
+       function getTagCounters($link) {
 
                $age_qpart = getMaxAgeSubquery();
 
 
                foreach (array_keys($tags) as $tag) {
                        $unread = $tags[$tag];                  
-
                        $tag = htmlspecialchars($tag);
-
-                       if (!$smart_mode || $old_counters[$tag] != $unread) {                   
-                               $old_counters[$tag] = $unread;
-                               $tctrs_modified = true;
-                               print "<counter type=\"tag\" id=\"$tag\" counter=\"$unread\"/>";
-                       }
-
+                       print "<counter type=\"tag\" id=\"$tag\" counter=\"$unread\"/>";
                } 
-
-               if ($smart_mode && $tctrs_modified) {
-                       $_SESSION["tctr_last_value"] = $old_counters;
-               }
-
        }
 
-       function getVirtCounters($link, $smart_mode = SMART_RPC_COUNTERS, $ret_mode = false) {
+       function getVirtCounters($link, $ret_mode = false) {
 
                $ret_arr = array();
 
                return $ret_arr;
        }
 
-       function getLabelCounters($link, $smart_mode = SMART_RPC_COUNTERS, $ret_mode = false) {
+       function getLabelCounters($link, $ret_mode = false) {
 
                $age_qpart = getMaxAgeSubquery();
 
-               if ($smart_mode) {
-                       if (!$_SESSION["lctr_last_value"]) {
-                               $_SESSION["lctr_last_value"] = array();
-                       }
-               }
-
-               $old_counters = $_SESSION["lctr_last_value"];
-               $lctrs_modified = false;
+               $owner_uid = $_SESSION["uid"];
 
+               $result = db_query($link, "SELECT id, caption FROM ttrss_labels2
+                       WHERE owner_uid = '$owner_uid'");
+       
+               while ($line = db_fetch_assoc($result)) {
 
-                       $owner_uid = $_SESSION["uid"];
+                       $id = -$line["id"] - 11;
 
-                       $result = db_query($link, "SELECT id, caption FROM ttrss_labels2
-                               WHERE owner_uid = '$owner_uid'");
-               
-                       while ($line = db_fetch_assoc($result)) {
-       
-                               $id = -$line["id"] - 11;
-       
-                               $label_name = $line["caption"];
-                               $count = getFeedUnread($link, $id);
-               
-                               if (!$smart_mode || $old_counters[$id] != $count) {     
-                                       $old_counters[$id] = $count;
-                                       $lctrs_modified = true;
-                                       if (!$ret_mode) {
-       
-                                               if (get_pref($link, 'EXTENDED_FEEDLIST')) {
-                                                       $xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
-                                               } else {
-                                                       $xmsg_part = "";
-                                               }
+                       $label_name = $line["caption"];
+                       $count = getFeedUnread($link, $id);
        
-                                               print "<counter type=\"label\" id=\"$id\" counter=\"$count\" $xmsg_part/>";
-                                       } else {
-                                               $ret_arr[$id]["counter"] = $count;
-                                               $ret_arr[$id]["description"] = $label_name;
-                                       }
+                       if (!$ret_mode) {
+
+                               if (get_pref($link, 'EXTENDED_FEEDLIST')) {
+                                       $xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
+                               } else {
+                                       $xmsg_part = "";
                                }
-       
-                               error_reporting (DEFAULT_ERROR_LEVEL);
-                       }
 
-               if ($smart_mode && $lctrs_modified) {
-                       $_SESSION["lctr_last_value"] = $old_counters;
-               }
+                               print "<counter type=\"label\" id=\"$id\" counter=\"$count\" $xmsg_part/>";
 
+                       } else {
+                               $ret_arr[$id]["counter"] = $count;
+                               $ret_arr[$id]["description"] = $label_name;
+                       }
+               }
+       
                return $ret_arr;
        }
 
-       function getFeedCounters($link, $smart_mode = SMART_RPC_COUNTERS, $active_feed = false) {
+       function getFeedCounters($link, $active_feed = false) {
 
                $age_qpart = getMaxAgeSubquery();
 
-               if ($smart_mode) {
-                       if (!$_SESSION["fctr_last_value"]) {
-                               $_SESSION["fctr_last_value"] = array();
-                       }
-               }
-
-               $old_counters = $_SESSION["fctr_last_value"];
-
                $query = "SELECT ttrss_feeds.id,
                                ttrss_feeds.title,
                                ".SUBSTRING_FOR_DATE."(ttrss_feeds.last_updated,1,19) AS last_updated, 
 
                        $count += db_fetch_result($tmp_result, 0, "unread");
 
-                       if (!$smart_mode || $old_counters[$id] != $count) {
-                               $old_counters[$id] = $count;
-                               $fctrs_modified = true;
-
-                               if ($last_error) {
-                                       $error_part = "error=\"$last_error\"";
-                               } else {
-                                       $error_part = "";
-                               }
-
-                               if ($has_img) {
-                                       $has_img_part = "hi=\"$has_img\"";
-                               } else {
-                                       $has_img_part = "";
-                               }                               
+                       if ($last_error) {
+                               $error_part = "error=\"$last_error\"";
+                       } else {
+                               $error_part = "";
+                       }
 
-                               if ($active_feed && $id == $active_feed) {
-                                       $has_title_part = "title=\"" . htmlspecialchars($line["title"]) . "\"";
-                               } else {
-                                       $has_title_part = "";
-                               }
+                       if ($has_img) {
+                               $has_img_part = "hi=\"$has_img\"";
+                       } else {
+                               $has_img_part = "";
+                       }                               
 
-                               if (get_pref($link, 'EXTENDED_FEEDLIST')) {
-                                       $xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
-                               }
+                       if ($active_feed && $id == $active_feed) {
+                               $has_title_part = "title=\"" . htmlspecialchars($line["title"]) . "\"";
+                       } else {
+                               $has_title_part = "";
+                       }
 
-                               print "<counter type=\"feed\" id=\"$id\" counter=\"$count\" $has_img_part $error_part updated=\"$last_updated\" $xmsg_part $has_title_part/>";
+                       if (get_pref($link, 'EXTENDED_FEEDLIST')) {
+                               $xmsg_part = "xmsg=\"(" . getFeedArticles($link, $id) . " total)\"";
                        }
-               }
 
-               if ($smart_mode && $fctrs_modified) {
-                       $_SESSION["fctr_last_value"] = $old_counters;
+                       print "<counter type=\"feed\" id=\"$id\" counter=\"$count\" $has_img_part $error_part updated=\"$last_updated\" $xmsg_part $has_title_part/>";
                }
        }
 
index 61703f9ec22d99f017e43aa05defd65dcfce6adb..e685cc8cbea304b777a5c65fe6ad7edd98245f2c 100644 (file)
@@ -47,7 +47,7 @@
                
                if (authenticate_user($link, $login, $pass)) {
 
-                       $counters = getLabelCounters($link, false, true);
+                       $counters = getLabelCounters($link, true);
 
                        foreach (array_keys($counters) as $id) {
                                $line_struct = new xmlrpcval(