[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/metamta/management/ -> PhabricatorMailManagementListOutboundWorkflow.php (source)

   1  <?php
   2  
   3  final class PhabricatorMailManagementListOutboundWorkflow
   4    extends PhabricatorMailManagementWorkflow {
   5  
   6    protected function didConstruct() {
   7      $this
   8        ->setName('list-outbound')
   9        ->setSynopsis('List outbound messages sent by Phabricator.')
  10        ->setExamples(
  11          '**list-outbound**')
  12        ->setArguments(
  13          array(
  14            array(
  15              'name'    => 'limit',
  16              'param'   => 'N',
  17              'default' => 100,
  18              'help'    => 'Show a specific number of messages (default 100).',
  19            ),
  20          ));
  21    }
  22  
  23    public function execute(PhutilArgumentParser $args) {
  24      $console = PhutilConsole::getConsole();
  25      $viewer = $this->getViewer();
  26  
  27      $mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
  28        '1 = 1 ORDER BY id DESC LIMIT %d',
  29        $args->getArg('limit'));
  30  
  31      if (!$mails) {
  32        $console->writeErr("%s\n", pht('No sent mail.'));
  33        return 0;
  34      }
  35  
  36      $table = id(new PhutilConsoleTable())
  37        ->setShowHeader(false)
  38        ->addColumn('id',      array('title' => 'ID'))
  39        ->addColumn('status',  array('title' => 'Status'))
  40        ->addColumn('subject', array('title' => 'Subject'));
  41  
  42      foreach (array_reverse($mails) as $mail) {
  43        $status = $mail->getStatus();
  44  
  45        $table->addRow(array(
  46          'id'      => $mail->getID(),
  47          'status'  => PhabricatorMetaMTAMail::getReadableStatus($status),
  48          'subject' => $mail->getSubject(),
  49        ));
  50      }
  51  
  52      $table->draw();
  53      return 0;
  54    }
  55  
  56  }


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