123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- defined('GNUSOCIAL') || die();
- class SiteConfirmReminderHandler extends QueueHandler
- {
-
- public function transport()
- {
- return 'siterem';
- }
-
- public function handle($remitem): bool
- {
- list($type, $opts) = $remitem;
- $qm = QueueManager::get();
- try {
- switch ($type) {
- case UserConfirmRegReminderHandler::REGISTER_REMINDER:
- $confirm = new Confirm_address();
- $confirm->address_type = $type;
- $confirm->find();
- while ($confirm->fetch()) {
- try {
- $qm->enqueue(array($confirm, $opts), 'uregrem');
- } catch (Exception $e) {
- common_log(LOG_WARNING, $e->getMessage());
- continue;
- }
- }
- break;
- case UserInviteReminderHandler::INVITE_REMINDER:
- $invitation = new Invitation();
-
- $sql = 'SELECT * FROM invitation ' .
- 'WHERE (address, created) IN ' .
- '(SELECT address, MAX(created) FROM invitation GROUP BY address) AND ' .
- 'registered_user_id IS NULL ' .
- 'ORDER BY created DESC';
- $invitation->query($sql);
- while ($invitation->fetch()) {
- try {
- $qm->enqueue(array($invitation, $opts), 'uinvrem');
- } catch (Exception $e) {
- common_log(LOG_WARNING, $e->getMessage());
- continue;
- }
- }
- break;
- default:
-
- common_log(
- LOG_ERR,
- "Received unknown confirmation address type",
- __FILE__
- );
- }
- } catch (Exception $e) {
- common_log(LOG_ERR, $e->getMessage());
- return false;
- }
- return true;
- }
- }
|