From 62e61a75f7c4f3152e16a0b267a578fba1cbba29 Mon Sep 17 00:00:00 2001 From: miqrogroove Date: Thu, 21 Jun 2018 07:43:40 -0400 Subject: [PATCH 1/6] Make Conversation Cleanup Configurable --- src/Worker/DBClean.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Worker/DBClean.php b/src/Worker/DBClean.php index 20691c178e..0fdcbfee6d 100644 --- a/src/Worker/DBClean.php +++ b/src/Worker/DBClean.php @@ -323,10 +323,11 @@ class DBClean { Config::set('system', 'dbclean-last-id-9', $last_id); } elseif ($stage == 10) { $last_id = Config::get('system', 'dbclean-last-id-10', 0); + $days = Config::get('system', 'dbclean-expire-conversation', 7); logger("Deleting old conversations. Last created: ".$last_id); $r = dba::p("SELECT `received`, `item-uri` FROM `conversation` - WHERE `received` < UTC_TIMESTAMP() - INTERVAL 90 DAY + WHERE `received` < UTC_TIMESTAMP() - INTERVAL $days DAY ORDER BY `received` LIMIT ".intval($limit)); $count = dba::num_rows($r); if ($count > 0) { From ab056f9ee58c24461d1f7b3d76727cb24aeb6890 Mon Sep 17 00:00:00 2001 From: miqrogroove Date: Thu, 21 Jun 2018 07:49:59 -0400 Subject: [PATCH 2/6] Update htconfig.md --- doc/htconfig.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/htconfig.md b/doc/htconfig.md index 296551244c..e3213b452e 100644 --- a/doc/htconfig.md +++ b/doc/htconfig.md @@ -37,6 +37,7 @@ Example: To set the automatic database cleanup process add this line to your .ht * **db_loglimit_index** - Number of index rows needed to be logged for indexes on the watchlist * **db_loglimit_index_high** - Number of index rows to be logged anyway (for any index) * **db_log_index_blacklist** - Blacklist of indexes that shouldn't be watched +* **dbclean_expire_conversation** (Integer) - When DBClean is enabled, any entry in the conversation table will be deleted after this many days. These data are normally needed only for debugging purposes and they are safe to delete. Default 7. * **diaspora_test** (Boolean) - For development only. Disables the message transfer. * **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS. * **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL. From cfe035f30000cbc580ebb3b699f92bab7c238687 Mon Sep 17 00:00:00 2001 From: miqrogroove Date: Thu, 21 Jun 2018 07:51:30 -0400 Subject: [PATCH 3/6] Update DBClean.php --- src/Worker/DBClean.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Worker/DBClean.php b/src/Worker/DBClean.php index 0fdcbfee6d..e1777f528f 100644 --- a/src/Worker/DBClean.php +++ b/src/Worker/DBClean.php @@ -323,7 +323,7 @@ class DBClean { Config::set('system', 'dbclean-last-id-9', $last_id); } elseif ($stage == 10) { $last_id = Config::get('system', 'dbclean-last-id-10', 0); - $days = Config::get('system', 'dbclean-expire-conversation', 7); + $days = Config::get('system', 'dbclean_expire_conversation', 7); logger("Deleting old conversations. Last created: ".$last_id); $r = dba::p("SELECT `received`, `item-uri` FROM `conversation` From f2463e327ab3fa89912c0185f322fe24b2111e03 Mon Sep 17 00:00:00 2001 From: miqrogroove Date: Thu, 21 Jun 2018 07:52:56 -0400 Subject: [PATCH 4/6] Update DBClean.php --- src/Worker/DBClean.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Worker/DBClean.php b/src/Worker/DBClean.php index e1777f528f..eeddea4c3e 100644 --- a/src/Worker/DBClean.php +++ b/src/Worker/DBClean.php @@ -323,7 +323,7 @@ class DBClean { Config::set('system', 'dbclean-last-id-9', $last_id); } elseif ($stage == 10) { $last_id = Config::get('system', 'dbclean-last-id-10', 0); - $days = Config::get('system', 'dbclean_expire_conversation', 7); + $days = intval(Config::get('system', 'dbclean_expire_conversation', 7)); logger("Deleting old conversations. Last created: ".$last_id); $r = dba::p("SELECT `received`, `item-uri` FROM `conversation` From d8646340c9b8b4e86805fa198738e7537e4cb8ab Mon Sep 17 00:00:00 2001 From: miqrogroove Date: Thu, 21 Jun 2018 08:25:58 -0400 Subject: [PATCH 5/6] Update htconfig.md --- doc/htconfig.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/htconfig.md b/doc/htconfig.md index e3213b452e..ef57380197 100644 --- a/doc/htconfig.md +++ b/doc/htconfig.md @@ -37,7 +37,7 @@ Example: To set the automatic database cleanup process add this line to your .ht * **db_loglimit_index** - Number of index rows needed to be logged for indexes on the watchlist * **db_loglimit_index_high** - Number of index rows to be logged anyway (for any index) * **db_log_index_blacklist** - Blacklist of indexes that shouldn't be watched -* **dbclean_expire_conversation** (Integer) - When DBClean is enabled, any entry in the conversation table will be deleted after this many days. These data are normally needed only for debugging purposes and they are safe to delete. Default 7. +* **dbclean_expire_conversation** (Integer) - When DBClean is enabled, any entry in the conversation table will be deleted after this many days. These data are normally needed only for debugging purposes and they are safe to delete. Default 90. * **diaspora_test** (Boolean) - For development only. Disables the message transfer. * **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS. * **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL. From 7f4bce67a86e60aed140c67bdae7907fee01f43c Mon Sep 17 00:00:00 2001 From: miqrogroove Date: Thu, 21 Jun 2018 08:27:36 -0400 Subject: [PATCH 6/6] Update DBClean.php --- src/Worker/DBClean.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Worker/DBClean.php b/src/Worker/DBClean.php index eeddea4c3e..ffeee5dd68 100644 --- a/src/Worker/DBClean.php +++ b/src/Worker/DBClean.php @@ -323,12 +323,12 @@ class DBClean { Config::set('system', 'dbclean-last-id-9', $last_id); } elseif ($stage == 10) { $last_id = Config::get('system', 'dbclean-last-id-10', 0); - $days = intval(Config::get('system', 'dbclean_expire_conversation', 7)); + $days = intval(Config::get('system', 'dbclean_expire_conversation', 90)); logger("Deleting old conversations. Last created: ".$last_id); $r = dba::p("SELECT `received`, `item-uri` FROM `conversation` - WHERE `received` < UTC_TIMESTAMP() - INTERVAL $days DAY - ORDER BY `received` LIMIT ".intval($limit)); + WHERE `received` < UTC_TIMESTAMP() - INTERVAL ? DAY + ORDER BY `received` LIMIT ?", $days, intval($limit)); $count = dba::num_rows($r); if ($count > 0) { logger("found old conversations: ".$count);