From 9c95fb7987f46984b73c29b4d092651a6b64fe87 Mon Sep 17 00:00:00 2001 From: Wytze van der Raay Date: Sat, 21 Feb 2015 14:06:54 +0000 Subject: [PATCH] Add two scripts for mailing to members who have agreed to the CCA when the wrong document was online for a short period at the beginning 2015. --- .../send_policy_cca_correct_20150221_1.php | 113 ++++++++++++++++++ .../send_policy_cca_correct_20150221_2.php | 97 +++++++++++++++ 2 files changed, 210 insertions(+) create mode 100644 scripts/send_policy_cca_correct_20150221_1.php create mode 100644 scripts/send_policy_cca_correct_20150221_2.php diff --git a/scripts/send_policy_cca_correct_20150221_1.php b/scripts/send_policy_cca_correct_20150221_1.php new file mode 100644 index 0000000..22ddf96 --- /dev/null +++ b/scripts/send_policy_cca_correct_20150221_1.php @@ -0,0 +1,113 @@ +#!/usr/bin/php -q += '2015-01-08 14:29:00' + AND user_agreements.date <= '2015-01-15 10:48:00' + AND user_agreements.document = 'CCA' + AND users.id NOT IN ( + SELECT user_agreements.memid + FROM user_agreements + WHERE user_agreements.date < '2015-01-08 14:29:00' + AND user_agreements.document = 'CCA') + GROUP BY users.id; + +$res = mysql_query($query); + +while($row = mysql_fetch_assoc($res)) +{ + $mailtxt = "Dear ${row["fname"]} ${row["lname"]},\n".$lines_EN."\n\n"; + + sendmail($row['email'], "[CAcert.org] CAcert Community Agreement (CCA)", $mailtxt, "support@cacert.org", "", "", "CAcert", "returns@cacert.org", ""); + + $fp = fopen("send_policy_cca_correct_20150221_1_lastid.txt", "w"); + fputs($fp, $row["id"]."\n"); + fclose($fp); + + $count++; + echo "Sent ${count}th mail. User ID: ${row["id"]}\n"; + + if(0 == $count % 5) { + sleep (1); + } +} diff --git a/scripts/send_policy_cca_correct_20150221_2.php b/scripts/send_policy_cca_correct_20150221_2.php new file mode 100644 index 0000000..3de568a --- /dev/null +++ b/scripts/send_policy_cca_correct_20150221_2.php @@ -0,0 +1,97 @@ +#!/usr/bin/php -q += '2015-01-08 14:29:00' + AND user_agreements.date <= '2015-01-15 10:48:00' + AND user_agreements.document = 'CCA' + AND users.id IN ( + SELECT users.id + FROM user_agreements + LEFT JOIN users ON users.id = user_agreements.memid + WHERE user_agreements.date < '2015-01-08 14:29:00' + AND user_agreements.document = 'CCA') + GROUP BY users.id; + +$res = mysql_query($query); + +while($row = mysql_fetch_assoc($res)) +{ + $mailtxt = "Dear ${row["fname"]} ${row["lname"]},\n".$lines_EN."\n\n"; + + sendmail($row['email'], "[CAcert.org] CAcert Community Agreement (CCA)", $mailtxt, "support@cacert.org", "", "", "CAcert", "returns@cacert.org", ""); + + $fp = fopen("send_policy_cca_correct_20150221_2_lastid.txt", "w"); + fputs($fp, $row["id"]."\n"); + fclose($fp); + + $count++; + echo "Sent ${count}th mail. User ID: ${row["id"]}\n"; + + if(0 == $count % 5) { + sleep (1); + } +}