Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / metamta / management / PhabricatorMailManagementListOutboundWorkflow.php
blob77c363a45b2fd5662d1a46fdafbb4ea525c03a83
1 <?php
3 final class PhabricatorMailManagementListOutboundWorkflow
4 extends PhabricatorMailManagementWorkflow {
6 protected function didConstruct() {
7 $this
8 ->setName('list-outbound')
9 ->setSynopsis(pht('List outbound messages.'))
10 ->setExamples('**list-outbound**')
11 ->setArguments(
12 array(
13 array(
14 'name' => 'limit',
15 'param' => 'N',
16 'default' => 100,
17 'help' => pht(
18 'Show a specific number of messages (default 100).'),
20 ));
23 public function execute(PhutilArgumentParser $args) {
24 $console = PhutilConsole::getConsole();
25 $viewer = $this->getViewer();
27 $mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
28 '1 = 1 ORDER BY id DESC LIMIT %d',
29 $args->getArg('limit'));
31 if (!$mails) {
32 $console->writeErr("%s\n", pht('No sent mail.'));
33 return 0;
36 $table = id(new PhutilConsoleTable())
37 ->setShowHeader(false)
38 ->addColumn('id', array('title' => pht('ID')))
39 ->addColumn('encrypt', array('title' => pht('#')))
40 ->addColumn('status', array('title' => pht('Status')))
41 ->addColumn('type', array('title' => pht('Type')))
42 ->addColumn('subject', array('title' => pht('Subject')));
44 foreach (array_reverse($mails) as $mail) {
45 $status = $mail->getStatus();
47 $table->addRow(array(
48 'id' => $mail->getID(),
49 'encrypt' => ($mail->getMustEncrypt() ? '#' : ' '),
50 'status' => PhabricatorMailOutboundStatus::getStatusName($status),
51 'type' => $mail->getMessageType(),
52 'subject' => $mail->getSubject(),
53 ));
56 $table->draw();
57 return 0;