From 733949e4673f27fff0451b9d9ad7281b5c416a48 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Thu, 7 Jul 2022 18:18:40 +0200 Subject: [PATCH] Add maintenance query to remove memid=0 emails This commit introduces a fix for wrongly inserted email addresses that have a memid=0 field because of MariaDBs strict mode that was enabled after moving from MySQL to MariaDB. Fixes https://bugs.cacert.org/view.php?id=1543 --- scripts/cron/removedead.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/cron/removedead.php b/scripts/cron/removedead.php index f473788..a9a1943 100755 --- a/scripts/cron/removedead.php +++ b/scripts/cron/removedead.php @@ -39,6 +39,12 @@ (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`created`)) >= 172800"; mysql_query($query); + // removes entries that where introduced due to missing/wrong default value + // in MariaDB strict mode, see https://bugs.cacert.org/view.php?id=1543 + $query = "delete from `email` where `memid`=0 and + (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`created`)) >= 172800"; + mysql_query($query); + $query = "delete from `disputedomain` where `hash`!='' and (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`created`)) >= 21600"; mysql_query($query); -- 2.30.2