From a2d799815a95e9c76e81525d1007b38971662e6d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 3 Oct 2010 12:19:09 +0400 Subject: [PATCH] remove unnecessary mentions of global_purge_old_posts; add debugging to purge_orphans() --- functions.php | 25 ++++++++++++------------- update_daemon2.php | 5 ----- update_daemon_loop.php | 6 ------ update_feeds.php | 3 --- 4 files changed, 12 insertions(+), 27 deletions(-) diff --git a/functions.php b/functions.php index 115bdfeb..cdbfa4ca 100644 --- a/functions.php +++ b/functions.php @@ -228,7 +228,7 @@ } // function purge_feed /** - * Purge old posts from old feeds. + * Purge old posts from old feeds. Not used anymore, purging is done after feed update. * * @param mixed $link A database connection * @param boolean $do_output Set to true to enable printed output, false by default. @@ -236,7 +236,7 @@ * @access public * @return void */ - function global_purge_old_posts($link, $do_output = false, $limit = false) { + /* function global_purge_old_posts($link, $do_output = false, $limit = false) { $random_qpart = sql_random_function(); @@ -276,16 +276,9 @@ } } - // purge orphaned posts in main content table - $result = db_query($link, "DELETE FROM ttrss_entries WHERE - (SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0"); - - if ($do_output) { - $rows = db_affected_rows($link, $result); - _debug("Purged $rows orphaned posts."); - } + purge_orphans($link, $do_output); - } // function global_purge_old_posts + } // function global_purge_old_posts */ function feed_purge_interval($link, $feed_id) { @@ -328,10 +321,16 @@ purge_orphans($link); } - function purge_orphans($link) { + function purge_orphans($link, $do_output = false) { + // purge orphaned posts in main content table - db_query($link, "DELETE FROM ttrss_entries WHERE + $result = db_query($link, "DELETE FROM ttrss_entries WHERE (SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0"); + + if ($do_output) { + $rows = db_affected_rows($link, $result); + _debug("Purged $rows orphaned posts."); + } } function get_feed_update_interval($link, $feed_id) { diff --git a/update_daemon2.php b/update_daemon2.php index 053a73d7..1b9e5763 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -177,11 +177,6 @@ print "warning: unable to create stampfile"; } - // 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); - // Call to the feed batch update function // or regenerate feedbrowser cache diff --git a/update_daemon_loop.php b/update_daemon_loop.php index 0586aa4d..7fa22d19 100755 --- a/update_daemon_loop.php +++ b/update_daemon_loop.php @@ -61,12 +61,6 @@ die; } -/* 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 diff --git a/update_feeds.php b/update_feeds.php index 0d93358e..6a4aa2a1 100755 --- a/update_feeds.php +++ b/update_feeds.php @@ -34,9 +34,6 @@ init_connection($link); - // Purge all posts (random 30 feeds) - //global_purge_old_posts($link, true, 30); - // Update all feeds needing a update. update_daemon_common($link); -- 2.39.5