3 * StatusNet - the distributed open-source microblogging tool
5 * Handler for reminder queue items which send reminder emails to all users
6 * we would like to complete a given process (e.g.: registration).
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * @author Zach Copley <zach@status.net>
24 * @copyright 2011 StatusNet, Inc.
25 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
26 * @link http://status.net/
29 if (!defined('STATUSNET')) {
34 * Handler for reminder queue items which send reminder emails to all users
35 * we would like to complete a given process (e.g.: registration)
39 * @author Zach Copley <zach@status.net>
40 * @copyright 2011 StatusNet, Inc.
41 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
42 * @link http://status.net/
44 class SiteConfirmReminderHandler extends QueueHandler
47 * Return transport keyword which identifies items this queue handler
48 * services; must be defined for all subclasses.
50 * Must be 8 characters or less to fit in the queue_item database.
51 * ex "email", "jabber", "sms", "irc", ...
63 * @param array $remitem type of reminder to send and any special options
64 * @return boolean true on success, false on failure
66 function handle($remitem)
68 list($type, $opts) = $remitem;
70 $qm = QueueManager::get();
74 case UserConfirmRegReminderHandler::REGISTER_REMINDER:
75 $confirm = new Confirm_address();
76 $confirm->address_type = $type;
78 while ($confirm->fetch()) {
80 $qm->enqueue(array($confirm, $opts), 'uregrem');
81 } catch (Exception $e) {
82 common_log(LOG_WARNING, $e->getMessage());
87 case UserInviteReminderHandler::INVITE_REMINDER:
88 $invitation = new Invitation();
89 // Only send one reminder (the latest one), regardless of how many invitations a user has
90 $sql = 'SELECT * FROM (SELECT * FROM invitation WHERE registered_user_id IS NULL ORDER BY created DESC) invitees GROUP BY invitees.address';
91 $invitation->query($sql);
92 while ($invitation->fetch()) {
94 $qm->enqueue(array($invitation, $opts), 'uinvrem');
95 } catch (Exception $e) {
96 common_log(LOG_WARNING, $e->getMessage());
105 "Received unknown confirmation address type",
109 } catch (Exception $e) {
110 common_log(LOG_ERR, $e->getMessage());