* only send the one invitation reminder per email address, regardless of how many invitations there are
* don't send invitations converted invitations * better error checking * more logging
This commit is contained in:
parent
e53dad35b8
commit
e7a4fee32b
|
@ -135,6 +135,11 @@ class EmailReminderPlugin extends Plugin
|
||||||
if (self::sendReminderEmail($type, $object, $subject, $title)) {
|
if (self::sendReminderEmail($type, $object, $subject, $title)) {
|
||||||
try {
|
try {
|
||||||
Email_reminder::recordReminder($type, $object, $day);
|
Email_reminder::recordReminder($type, $object, $day);
|
||||||
|
common_log(
|
||||||
|
LOG_INFO,
|
||||||
|
"Sent {$type} reminder to {$object->address}.",
|
||||||
|
__FILE__
|
||||||
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// oh noez
|
// oh noez
|
||||||
common_log(LOG_ERR, $e->getMessage(), __FILE__);
|
common_log(LOG_ERR, $e->getMessage(), __FILE__);
|
||||||
|
|
|
@ -86,7 +86,9 @@ class SiteConfirmReminderHandler extends QueueHandler
|
||||||
break;
|
break;
|
||||||
case UserInviteReminderHandler::INVITE_REMINDER:
|
case UserInviteReminderHandler::INVITE_REMINDER:
|
||||||
$invitation = new Invitation();
|
$invitation = new Invitation();
|
||||||
$invitation->find();
|
// Only send one reminder (the latest one), regardless of how many invitations a user has
|
||||||
|
$sql = 'SELECT * FROM (SELECT * FROM invitation WHERE registered_user_id IS NULL ORDER BY created DESC) invitees GROUP BY invitees.address';
|
||||||
|
$invitation->query($sql);
|
||||||
while ($invitation->fetch()) {
|
while ($invitation->fetch()) {
|
||||||
try {
|
try {
|
||||||
$qm->enqueue(array($invitation, $opts), 'uinvrem');
|
$qm->enqueue(array($invitation, $opts), 'uinvrem');
|
||||||
|
|
|
@ -141,6 +141,9 @@ class UserConfirmRegReminderHandler extends UserReminderHandler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
common_log(LOG_INFO, "No need to send registration reminder to {$confirm->address}.", __FILE__);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,9 @@ class UserInviteReminderHandler extends UserReminderHandler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
common_log(LOG_INFO, "No need to send invitation reminder to {$invitation->address}.", __FILE__);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,19 +90,32 @@ case 'all':
|
||||||
|
|
||||||
if (have_option('u', 'universe')) {
|
if (have_option('u', 'universe')) {
|
||||||
$sn = new Status_network();
|
$sn = new Status_network();
|
||||||
if ($sn->find()) {
|
try {
|
||||||
while ($sn->fetch()) {
|
if ($sn->find()) {
|
||||||
$server = $sn->getServerName();
|
while ($sn->fetch()) {
|
||||||
StatusNet::init($server);
|
try {
|
||||||
// Different queue manager, maybe!
|
$server = $sn->getServerName();
|
||||||
$qm = QueueManager::get();
|
StatusNet::init($server);
|
||||||
foreach ($reminders as $reminder) {
|
// Different queue manager, maybe!
|
||||||
extract($reminder);
|
$qm = QueueManager::get();
|
||||||
$qm->enqueue(array($type, $opts), 'siterem');
|
foreach ($reminders as $reminder) {
|
||||||
if (!$quiet) { print "Sent pending {$type} reminders for {$server}.\n"; }
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!$quiet) { print "Done! Reminders sent to all unconfirmed addresses in the known universe.\n"; }
|
||||||
}
|
}
|
||||||
if (!$quiet) { print "Done! Reminders sent to all unconfirmed addresses in the known universe.\n"; }
|
} catch (Exception $e) {
|
||||||
|
if (!$quiet) { print $e->getMessage() . "\n"; }
|
||||||
|
common_log(LOG_ERR, $e->getMessage(), __FILE__);
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$qm = QueueManager::get();
|
$qm = QueueManager::get();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user