X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FEmailReminder%2Fscripts%2Fsendemailreminder.php;h=2cc214a671c04e11bd874563099e3f0f0029e59d;hb=5eba1030ae39038b7b6b0aad5de1043fae43e48d;hp=4cb7087fc720044ee427ce27b0a313ad4b5d4b10;hpb=01996b1a460693227ef263d44477bc12d297a70a;p=quix0rs-gnu-social.git diff --git a/plugins/EmailReminder/scripts/sendemailreminder.php b/plugins/EmailReminder/scripts/sendemailreminder.php index 4cb7087fc7..2cc214a671 100644 --- a/plugins/EmailReminder/scripts/sendemailreminder.php +++ b/plugins/EmailReminder/scripts/sendemailreminder.php @@ -20,8 +20,8 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); -$shortoptions = 't:e:au'; -$longoptions = array('type=', 'email=', 'all', 'universe'); +$shortoptions = 't:e:auo'; +$longoptions = array('type=', 'email=', 'all', 'universe', 'onetime'); $helptext = <<find()) { - while ($sn->fetch()) { - $server = $sn->getServerName(); - StatusNet::init($server); - // Different queue manager, maybe! - $qm = QueueManager::get(); - foreach ($reminders as $reminder) { - extract($reminder); - $qm->enqueue($type, 'siterem'); - if (!$quiet) { print "Sent pending {$type} reminders to all unconfirmed addresses in the known universe.\n"; } + try { + if ($sn->find()) { + while ($sn->fetch()) { + try { + $server = $sn->getServerName(); + StatusNet::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; + } } + 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 { $qm = QueueManager::get(); @@ -111,13 +132,13 @@ if (have_option('u', 'universe')) { if (empty($result)) { throw new Exception("No confirmation code found for {$address}."); } - $qm->enqueue($confirm, $utransport); + $qm->enqueue(array($confirm, $opts), $utransport); 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($type, 'siterem'); + $qm->enqueue(array($type, $opts), 'siterem'); if (!$quiet) { print "Sent pending {$type} reminders to all unconfirmed addresses on the site.\n"; } } } else {