]> git.wh0rd.org Git - tt-rss.git/commitdiff
purge feeds after updating
authorAndrew Dolgov <fox@bah.spb.su>
Tue, 20 Jan 2009 12:35:59 +0000 (13:35 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Tue, 20 Jan 2009 12:35:59 +0000 (13:35 +0100)
config.php-dist
functions.php
modules/pref-feeds.php
modules/pref-prefs.php
update_daemon2.php
update_daemon_loop.php
update_feeds.php

index c5417ec24a65e7c7b77d8759038c1f60dd1652cc..78f1a2b3f0a93b78b0a844e65a3ab7386836ca36 100644 (file)
        // Displays an URL for users to provide feedback or comments regarding
        // this instance of tt-rss. Can lead to a forum, contact email, etc.
 
+       define('FORCE_ARTICLE_PURGE', 0);
+       // When this option is not 0, users ability to control feed purging
+       // intervals is disabled and all articles (which are not starred) 
+       // older than this amount of days are purged.
+
        define('CONFIG_VERSION', 18);
        // Expected config version. Please update this option in config.php
        // if necessary (after migrating all new options from this file).
index 962057e339084ab4993ef0ea363f51e867a7df92..565c5d1032cca34d497f90db239f89f432e7494e 100644 (file)
 
                if (!$owner_uid) return;
 
-               $purge_unread = get_pref($link, "PURGE_UNREAD_ARTICLES",
-                       $owner_uid, false);
+               if (FORCE_ARTICLE_PURGE == 0) {
+                       $purge_unread = get_pref($link, "PURGE_UNREAD_ARTICLES",
+                               $owner_uid, false);
+               } else {
+                       $purge_unread = true;
+                       $purge_interval = FORCE_ARTICLE_PURGE;
+               }
 
                if (!$purge_unread) $query_limit = " unread = false AND ";
 
 //                             print "Feed $feed_id: purge interval = $purge_interval\n";
                        }
 
-                       if ($purge_interval > 0) {
+                       if ($purge_interval > 0 || FORCE_ARTICLE_PURGE) {
                                purge_feed($link, $feed_id, $purge_interval, $do_output);
                        }
                }       
                                        _debug("update_rss_feed: updating counters cache...");
                                }
 
-                               ccache_update($link, $feed, $owner_uid);
+                               // disabled, purge_feed() does that...
+                               //ccache_update($link, $feed, $owner_uid);
                        }
 
+                       purge_feed($link, $feed, 0, true);
+
                        db_query($link, "UPDATE ttrss_feeds 
                                SET last_updated = NOW(), last_error = '' WHERE id = '$feed'");
 
index 8b715e48f87ae04d0588aa828bed0d47d1898c25..532a8f53179cf5b633862e8f9d52a92f52eb50b8 100644 (file)
                                print_select_hash("update_method", $update_method, $update_methods);                    
                        }
 
-                       /* Purge intl */
+                       if (FORCE_ARTICLE_PURGE == 0) {
 
-                       print "<br/>";
+                               /* Purge intl */
+
+                               print "<br/>";
+
+                               $purge_interval = db_fetch_result($result, 0, "purge_interval");
 
-                       $purge_interval = db_fetch_result($result, 0, "purge_interval");
+                               print __('Article purging:') . " ";
 
-                       print __('Article purging:') . " ";
+                               print_select_hash("purge_interval", $purge_interval, $purge_intervals);
 
-                       print_select_hash("purge_interval", $purge_interval, $purge_intervals);
+                       }
 
                        print "</div>";
                        print "<div class=\"dlgSec\">".__("Authentication")."</div>";
 
                        /* Purge intl */
 
-                       print "<br/>";
+                       if (FORCE_ARTICLE_PURGE != 0) {
 
-                       print __('Article purging:') . " ";
+                               print "<br/>";
 
-                       print_select_hash("purge_interval", $purge_interval, $purge_intervals,
-                               "disabled");
+                               print __('Article purging:') . " ";
 
-                       batch_edit_cbox("purge_interval");
+                               print_select_hash("purge_interval", $purge_interval, $purge_intervals,
+                                       "disabled");
+
+                               batch_edit_cbox("purge_interval");
+                       }
 
                        print "</div>";
                        print "<div class=\"dlgSec\">".__("Authentication")."</div>";
index 987a093c0c72b3ef3bde94e5bafe9ac53ffaf863..80a63cb9e6a10d65d26f22d5aece5f4bd9abbf47 100644 (file)
 
                $prefs_blacklist = array("HIDE_FEEDLIST", "SYNC_COUNTERS", "ENABLE_LABELS");
 
+               if (FORCE_ARTICLE_PURGE != 0) {
+                       array_push($prefs_blacklist, "PURGE_OLD_DAYS");
+                       array_push($prefs_blacklist, "PURGE_UNREAD_ARTICLES");
+               }
+
                if ($subop == "change-password") {
 
                        $old_pw = $_POST["OLD_PASSWORD"];
index 45ba2fbf287e0a54d31151d9266e36650dc1093d..777b835ab379fda452e60aca0bbf1c37d623f43e 100644 (file)
 
                                        // FIXME : $last_purge is of no use in a multiprocess update.
                                        // FIXME : We ALWAYS purge old posts.
-                                       _debug("Purging old posts (random 30 feeds)...");
-                                       global_purge_old_posts($link, true, 30);
+                                       //_debug("Purging old posts (random 30 feeds)...");
+                                       //global_purge_old_posts($link, true, 30);
 
                                        // Call to the feed batch update function 
                                        // or regenerate feedbrowser cache
index d3c760d87a73f5c849592ce01e4c5921cbf051ce..668b19abca9c76808a3635562ad7ddbc011517fa 100644 (file)
                die;
        }
 
-       if (time() - $last_purge > PURGE_INTERVAL) {
+/*     if (time() - $last_purge > PURGE_INTERVAL) {
                _debug("Purging old posts (random 30 feeds)...");
                global_purge_old_posts($link, true, 30);
                $last_purge = time();
-       }
+       } */
 
        // Call to the feed batch update function 
        // or regenerate feedbrowser cache
index 2bb91dc30182d47547e6beaf027de1794941da85..e08c6f3924c617daebf15a1b392f06673fa02a1f 100644 (file)
@@ -39,7 +39,7 @@
        init_connection($link);
 
        // Purge all posts (random 30 feeds)
-       global_purge_old_posts($link, true, 30);
+       //global_purge_old_posts($link, true, 30);
 
        // Update all feeds needing a update.
        update_daemon_common($link);