3 final class PhabricatorMailManagementListInboundWorkflow
4 extends PhabricatorMailManagementWorkflow
{
6 protected function didConstruct() {
8 ->setName('list-inbound')
9 ->setSynopsis(pht('List inbound messages.'))
19 'Show a specific number of messages (default 100).'),
24 public function execute(PhutilArgumentParser
$args) {
25 $console = PhutilConsole
::getConsole();
26 $viewer = $this->getViewer();
28 $mails = id(new PhabricatorMetaMTAReceivedMail())->loadAllWhere(
29 '1 = 1 ORDER BY id DESC LIMIT %d',
30 $args->getArg('limit'));
33 $console->writeErr("%s\n", pht('No received mail.'));
38 mpull($mails, 'getRelatedPHID'),
39 mpull($mails, 'getAuthorPHID'));
40 $handles = id(new PhabricatorHandleQuery())
45 $table = id(new PhutilConsoleTable())
46 ->setShowHeader(false)
47 ->addColumn('id', array('title' => pht('ID')))
48 ->addColumn('author', array('title' => pht('Author')))
49 ->addColumn('phid', array('title' => pht('Related PHID')))
50 ->addColumn('subject', array('title' => pht('Subject')));
52 foreach (array_reverse($mails) as $mail) {
54 'id' => $mail->getID(),
55 'author' => $mail->getAuthorPHID()
56 ?
$handles[$mail->getAuthorPHID()]->getName()
58 'phid' => $mail->getRelatedPHID()
59 ?
$handles[$mail->getRelatedPHID()]->getName()
61 'subject' => $mail->getSubject()
63 : pht('(No subject.)'),