[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/metamta/ -> PhabricatorMetaMTAWorker.php (source)

   1  <?php
   2  
   3  final class PhabricatorMetaMTAWorker
   4    extends PhabricatorWorker {
   5  
   6    public function getMaximumRetryCount() {
   7      return 250;
   8    }
   9  
  10    public function getWaitBeforeRetry(PhabricatorWorkerTask $task) {
  11      return ($task->getFailureCount() * 15);
  12    }
  13  
  14    public function doWork() {
  15      $message = $this->loadMessage();
  16      if (!$message) {
  17        throw new PhabricatorWorkerPermanentFailureException(
  18          pht('Unable to load message!'));
  19      }
  20  
  21      if ($message->getStatus() != PhabricatorMetaMTAMail::STATUS_QUEUE) {
  22        return;
  23      }
  24  
  25      try {
  26        $message->sendNow();
  27      } catch (PhabricatorMetaMTAPermanentFailureException $ex) {
  28        // If the mailer fails permanently, fail this task permanently.
  29        throw new PhabricatorWorkerPermanentFailureException($ex->getMessage());
  30      }
  31    }
  32  
  33    private function loadMessage() {
  34      $message_id = $this->getTaskData();
  35      return id(new PhabricatorMetaMTAMail())->load($message_id);
  36    }
  37  
  38    public function renderForDisplay(PhabricatorUser $viewer) {
  39      return phutil_tag(
  40        'pre',
  41        array(
  42        ),
  43        'phabricator/ $ ./bin/mail show-outbound --id '.$this->getTaskData());
  44    }
  45  
  46  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1