gnu-social/plugins/EmailReminder/scripts/sendemailreminder.php

154 lines
5.1 KiB
PHP
Raw Normal View History

EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 't:e:auo';
$longoptions = array('type=', 'email=', 'all', 'universe', 'onetime');
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
$helptext = <<<END_OF_SENDEMAILREMINDER_HELP
sendemailreminder.php [options]
Send an email summary of the inbox to users
-t --type type of reminder to send (register | invite | all)
-e --email email address to send reminder to
-a --all send reminder to all addresses
-u --universe send reminder to all addresses on all sites
-o --onetime send one-time reminder to older addresses
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
END_OF_SENDEMAILREMINDER_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$quiet = have_option('q', 'quiet');
$types = array(
// registration confirmation reminder
'register' => array(
'type' => 'register',
'className' => 'Confirm_address',
'utransport' => 'uregrem'
),
// invitation confirmation reminder
'invite' => array(
'type' => 'invite',
'className' => 'Invitation',
'utransport' => 'uinvrem'
)
// ... add more here
);
$type = null;
$opts = array(); // special options like "onetime"
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
if (have_option('t', 'type')) {
$type = trim(get_option_value('t', 'type'));
if (!in_array($type, array_keys($types)) && $type !== 'all') {
print _m("Unknown reminder type: {$type}.\n");
exit(1);
}
} else {
show_help();
exit(1);
}
if (have_option('o', 'onetime')) {
$opts['onetime'] = true;
if (!$quiet) { print "Special one-time reminder mode.\n"; }
}
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
$reminders = array();
switch($type) {
case 'register':
$reminders[] = $types['register'];
break;
case 'invite':
$reminders[] = $types['invite'];
break;
case 'all':
$reminders = $types;
break;
}
if (have_option('u', 'universe')) {
$sn = new Status_network();
try {
if ($sn->find()) {
while ($sn->fetch()) {
try {
$server = $sn->getServerName();
GNUsocial::init($server);
// Different queue manager, maybe!
$qm = QueueManager::get();
foreach ($reminders as $reminder) {
extract($reminder);
$qm->enqueue(array($type, $opts), 'siterem');
if (!$quiet) { print "Sent pending {$type} reminders for {$server}.\n"; }
}
} catch (Exception $e) {
// keep going
common_log(LOG_ERR, "Couldn't init {$server}.\n", __FILE__);
if (!$quiet) { print "Couldn't init {$server}.\n"; }
continue;
}
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
}
if (!$quiet) { print "Done! Reminders sent to all unconfirmed addresses in the known universe.\n"; }
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
}
} catch (Exception $e) {
if (!$quiet) { print $e->getMessage() . "\n"; }
common_log(LOG_ERR, $e->getMessage(), __FILE__);
exit(1);
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
}
} else {
$qm = QueueManager::get();
try {
// enqueue reminder for specific email address or all unconfirmed addresses
if (have_option('e', 'email')) {
$address = trim(get_option_value('e', 'email'));
foreach ($reminders as $reminder) {
// real bad voodoo here
extract($reminder);
$confirm = new $className;
$confirm->address = $address;
$result = $confirm->find(true);
if (empty($result)) {
throw new Exception("No confirmation code found for {$address}.");
}
$qm->enqueue(array($confirm, $opts), $utransport);
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
if (!$quiet) { print "Sent all pending {$type} reminder to {$address}.\n"; }
}
} else if (have_option('a', 'all')) {
foreach ($reminders as $reminder) {
extract($reminder);
$qm->enqueue(array($type, $opts), 'siterem');
EmailReminder plugin to send reminders about various things * Needs some cleanup and testing * Email templates need work * More documentation Squashed commit of the following: commit 1c7b418dad5ec1b7713d61b6a42d6d7a394d500f Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:17:31 2011 -0700 * Set the reminder interval correctly commit ae0ded8cf95210f54b4cd58dac0eeeedf2d99c67 Author: Zach Copley <zach@status.net> Date: Fri Jun 17 02:15:01 2011 -0700 Send email reminders for invitations commit 1b596d08f5dbe765a16fbdfbd21e2ad68e8b0058 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 23:53:48 2011 -0700 Handle multiple confirmation types commit 25d83351d878f39498cd6a14fddde27f1afef2ca Author: Zach Copley <zach@status.net> Date: Thu Jun 16 18:04:57 2011 -0700 Actually send reminders and record a record of doing so commit 9ffc2dbee15cacc7e7f9feab492185ee9964a17e Author: Zach Copley <zach@status.net> Date: Thu Jun 16 14:20:16 2011 -0700 Make the queue handling actually work commit 2a6ce3c17c045bdb0a3ddf36f2c290c9c48eb003 Author: Zach Copley <zach@status.net> Date: Thu Jun 16 13:27:56 2011 -0700 Fix syntax errors commit 054b54847dfadc490aa7d7dff12d473af31c99bb Author: Zach Copley <zach@status.net> Date: Thu Jun 16 00:36:37 2011 -0700 Registration reminders should work now, but code is untested commit b44117017b64635aae340c260167cf1efab9b2ae Merge: 9d1441d f74de88 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:43:19 2011 -0700 Merge branch 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone into email-reminder * 'email-reminder' of gitorious.org:~zcopley/statusnet/zcopleys-clone: Stubby EmailReminderPlugin and data class Remove bogus data class Conflicts: plugins/EmailReminder/EmailReminderPlugin.php plugins/EmailReminder/classes/Email_reminder.php commit 9d1441d7366df57e38cdfaf96e006f7d2f29d889 Author: Zach Copley <zach@status.net> Date: Tue Jun 14 09:23:23 2011 -0700 Most of the other classes needed to send email reminders commit 4e9bb11dbb23556bf5c1847e7a127084b5cc217c Author: Zach Copley <zach@status.net> Date: Mon Jun 13 12:10:55 2011 -0700 size -> length commit a9ea80ef8abae1e64d5713091baedd931b7184e2 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5d893f982209b245cb9113a59e49721dd6e191b6 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class commit f74de8841a98add73536fd8a4d3cee76035b491c Author: Zach Copley <zach@status.net> Date: Fri Jun 10 16:38:06 2011 -0400 Stubby EmailReminderPlugin and data class commit 5b14370918233e5112a95da94567c4ed83429bc9 Author: Zach Copley <zach@status.net> Date: Fri Jun 10 14:01:48 2011 -0400 Remove bogus data class
2011-06-17 10:24:34 +01:00
if (!$quiet) { print "Sent pending {$type} reminders to all unconfirmed addresses on the site.\n"; }
}
} else {
show_help();
exit(1);
}
} catch (Exception $e) {
if (!$quiet) { print $e->getMessage() . "\n"; }
common_log(LOG_ERR, $e->getMessage(), __FILE__);
exit(1);
}
}