Fix email notifications for @-replies that come via OStatus.

* Moved notification sending from Notice::saveReplies to distrib queue handler, so it'll pull from the reply set we've saved regardless of how we got it.
* Set up gettext infrastructure for command-line scripts; gets localization mail notifications etc working from background queues.
* Adjusted locale switching: common_switch_locale() works at runtime for bg scripts, forces a message catalog update
This commit is contained in:
Brion Vibber
2010-04-20 12:06:54 +02:00
parent 0e1be7e01b
commit c48caa85e1
5 changed files with 81 additions and 19 deletions

View File

@@ -49,25 +49,34 @@ class DistribQueueHandler
}
/**
* Here's the meat of your queue handler -- you're handed a Notice
* object, which you may do as you will with.
* Handle distribution of a notice after we've saved it:
* @li add to local recipient inboxes
* @li send email notifications to local @-reply targets
* @li run final EndNoticeSave plugin events
* @li put any remaining post-processing into the queues
*
* If this function indicates failure, a warning will be logged
* and the item is placed back in the queue to be re-run.
*
* @fixme addToInboxes is known to fail sometimes with large recipient sets
*
* @param Notice $notice
* @return boolean true on success, false on failure
*/
function handle($notice)
{
// XXX: do we need to change this for remote users?
try {
$notice->addToInboxes();
} catch (Exception $e) {
$this->logit($notice, $e);
}
try {
$notice->sendReplyNotifications();
} catch (Exception $e) {
$this->logit($notice, $e);
}
try {
Event::handle('EndNoticeSave', array($notice));
// Enqueue for other handlers