2013-05-20 19:13:42 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorMailManagementShowOutboundWorkflow
|
2013-12-27 22:15:48 +01:00
|
|
|
extends PhabricatorMailManagementWorkflow {
|
2013-05-20 19:13:42 +02:00
|
|
|
|
|
|
|
protected function didConstruct() {
|
|
|
|
$this
|
|
|
|
->setName('show-outbound')
|
|
|
|
->setSynopsis('Show diagnostic details about outbound mail.')
|
|
|
|
->setExamples(
|
2014-06-09 20:36:49 +02:00
|
|
|
'**show-outbound** --id 1 --id 2')
|
2013-05-20 19:13:42 +02:00
|
|
|
->setArguments(
|
|
|
|
array(
|
|
|
|
array(
|
|
|
|
'name' => 'id',
|
|
|
|
'param' => 'id',
|
|
|
|
'help' => 'Show details about outbound mail with given ID.',
|
|
|
|
'repeat' => true,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function execute(PhutilArgumentParser $args) {
|
|
|
|
$console = PhutilConsole::getConsole();
|
|
|
|
|
|
|
|
$ids = $args->getArg('id');
|
|
|
|
if (!$ids) {
|
|
|
|
throw new PhutilArgumentUsageException(
|
|
|
|
"Use the '--id' flag to specify one or more messages to show.");
|
|
|
|
}
|
|
|
|
|
|
|
|
$messages = id(new PhabricatorMetaMTAMail())->loadAllWhere(
|
|
|
|
'id IN (%Ld)',
|
|
|
|
$ids);
|
|
|
|
|
|
|
|
if ($ids) {
|
|
|
|
$ids = array_fuse($ids);
|
|
|
|
$missing = array_diff_key($ids, $messages);
|
|
|
|
if ($missing) {
|
|
|
|
throw new PhutilArgumentUsageException(
|
2014-06-09 20:36:49 +02:00
|
|
|
'Some specified messages do not exist: '.
|
2013-05-20 19:13:42 +02:00
|
|
|
implode(', ', array_keys($missing)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$last_key = last_key($messages);
|
|
|
|
foreach ($messages as $message_key => $message) {
|
|
|
|
$info = array();
|
|
|
|
|
|
|
|
$info[] = pht('PROPERTIES');
|
|
|
|
$info[] = pht('ID: %d', $message->getID());
|
|
|
|
$info[] = pht('Status: %s', $message->getStatus());
|
|
|
|
$info[] = pht('Related PHID: %s', $message->getRelatedPHID());
|
|
|
|
$info[] = pht('Message: %s', $message->getMessage());
|
|
|
|
|
|
|
|
$info[] = null;
|
|
|
|
$info[] = pht('PARAMETERS');
|
Move outbound mail lists to CLI and enhance details
Summary: Finish off moving all this stuff to the CLI. Ref T3306.
Test Plan:
PROPERTIES
ID: 6483
Status: void
Retry Count: 0
Next Retry: 1373494457
Related PHID: PHID-DREV-5bnb33yeuhuaulyc3exg
Message: Message has no valid recipients: all To/Cc are disabled, invalid, or configured not to receive this mail.
PARAMETERS
from: PHID-USER-lqiz3yd7wmk64ejugvov
is-html:
parent-message-id: null
thread-id: differential-rev-PHID-DREV-5bnb33yeuhuaulyc3exg-req
is-first-message: null
is-bulk: 1
mailtags: ["differential-comment"]
cc: ["PHID-USER-cluwcdowc35gmperlkbi"]
subject: D22: quack quack
subject-prefix: [Differential]
vary-subject-prefix: [Commented On]
worker-task: 936546
HEADERS
Thread-Topic: D22: quack quack
X-Herald-Rules: none
X-Differential-Author: <PHID-USER-lqiz3yd7wmk64ejugvov>
X-Differential-CC: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Differential-CC: <PHID-USER-cluwcdowc35gmperlkbi>
X-Differential-CC: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Differential-CC: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Differential-CC: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Differential-CC: <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-CCs: <PHID-USER-ly3pvrtdkw7lbgs72jvr>, <PHID-USER-cluwcdowc35gmperlkbi>, <PHID-MLST-wkxaantg3q6pgdkty5pt>, <PHID-USER-aeabc4ipqbifny3rw4ok>, <PHID-USER-zqxtb3oi4pouwxnxlv3f>, <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-Explicit-CC: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Differential-Explicit-CC: <PHID-USER-cluwcdowc35gmperlkbi>
X-Differential-Explicit-CC: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Differential-Explicit-CC: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Differential-Explicit-CC: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Differential-Explicit-CC: <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-Explicit-CCs: <PHID-USER-ly3pvrtdkw7lbgs72jvr>, <PHID-USER-cluwcdowc35gmperlkbi>, <PHID-MLST-wkxaantg3q6pgdkty5pt>, <PHID-USER-aeabc4ipqbifny3rw4ok>, <PHID-USER-zqxtb3oi4pouwxnxlv3f>, <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Phabricator-To: <PHID-USER-lqiz3yd7wmk64ejugvov>
X-Phabricator-Cc: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Phabricator-Cc: <PHID-USER-cluwcdowc35gmperlkbi>
X-Phabricator-Cc: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Phabricator-Cc: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Phabricator-Cc: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Phabricator-Cc: <PHID-USER-cknqtm2dzw7twnwyiaye>
RECIPIENTS
! dog (dog)
- This user is disabled; disabled users do not receive mail.
BODY
epriestley has commented on the revision "quack quack".
zxcbzxcb
REVISION DETAIL
http://local.aphront.com:8080/D22
To: epriestley
Cc: Unknown User, dog, list, duck, epriestley992, asana
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3306
Differential Revision: https://secure.phabricator.com/D6423
2013-07-11 03:52:22 +02:00
|
|
|
$parameters = $message->getParameters();
|
|
|
|
foreach ($parameters as $key => $value) {
|
2013-05-20 19:13:42 +02:00
|
|
|
if ($key == 'body') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
Move outbound mail lists to CLI and enhance details
Summary: Finish off moving all this stuff to the CLI. Ref T3306.
Test Plan:
PROPERTIES
ID: 6483
Status: void
Retry Count: 0
Next Retry: 1373494457
Related PHID: PHID-DREV-5bnb33yeuhuaulyc3exg
Message: Message has no valid recipients: all To/Cc are disabled, invalid, or configured not to receive this mail.
PARAMETERS
from: PHID-USER-lqiz3yd7wmk64ejugvov
is-html:
parent-message-id: null
thread-id: differential-rev-PHID-DREV-5bnb33yeuhuaulyc3exg-req
is-first-message: null
is-bulk: 1
mailtags: ["differential-comment"]
cc: ["PHID-USER-cluwcdowc35gmperlkbi"]
subject: D22: quack quack
subject-prefix: [Differential]
vary-subject-prefix: [Commented On]
worker-task: 936546
HEADERS
Thread-Topic: D22: quack quack
X-Herald-Rules: none
X-Differential-Author: <PHID-USER-lqiz3yd7wmk64ejugvov>
X-Differential-CC: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Differential-CC: <PHID-USER-cluwcdowc35gmperlkbi>
X-Differential-CC: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Differential-CC: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Differential-CC: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Differential-CC: <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-CCs: <PHID-USER-ly3pvrtdkw7lbgs72jvr>, <PHID-USER-cluwcdowc35gmperlkbi>, <PHID-MLST-wkxaantg3q6pgdkty5pt>, <PHID-USER-aeabc4ipqbifny3rw4ok>, <PHID-USER-zqxtb3oi4pouwxnxlv3f>, <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-Explicit-CC: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Differential-Explicit-CC: <PHID-USER-cluwcdowc35gmperlkbi>
X-Differential-Explicit-CC: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Differential-Explicit-CC: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Differential-Explicit-CC: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Differential-Explicit-CC: <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-Explicit-CCs: <PHID-USER-ly3pvrtdkw7lbgs72jvr>, <PHID-USER-cluwcdowc35gmperlkbi>, <PHID-MLST-wkxaantg3q6pgdkty5pt>, <PHID-USER-aeabc4ipqbifny3rw4ok>, <PHID-USER-zqxtb3oi4pouwxnxlv3f>, <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Phabricator-To: <PHID-USER-lqiz3yd7wmk64ejugvov>
X-Phabricator-Cc: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Phabricator-Cc: <PHID-USER-cluwcdowc35gmperlkbi>
X-Phabricator-Cc: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Phabricator-Cc: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Phabricator-Cc: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Phabricator-Cc: <PHID-USER-cknqtm2dzw7twnwyiaye>
RECIPIENTS
! dog (dog)
- This user is disabled; disabled users do not receive mail.
BODY
epriestley has commented on the revision "quack quack".
zxcbzxcb
REVISION DETAIL
http://local.aphront.com:8080/D22
To: epriestley
Cc: Unknown User, dog, list, duck, epriestley992, asana
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3306
Differential Revision: https://secure.phabricator.com/D6423
2013-07-11 03:52:22 +02:00
|
|
|
if ($key == 'headers') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($key == 'attachments') {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-05-20 19:13:42 +02:00
|
|
|
if (!is_scalar($value)) {
|
|
|
|
$value = json_encode($value);
|
|
|
|
}
|
|
|
|
|
|
|
|
$info[] = pht('%s: %s', $key, $value);
|
|
|
|
}
|
|
|
|
|
Move outbound mail lists to CLI and enhance details
Summary: Finish off moving all this stuff to the CLI. Ref T3306.
Test Plan:
PROPERTIES
ID: 6483
Status: void
Retry Count: 0
Next Retry: 1373494457
Related PHID: PHID-DREV-5bnb33yeuhuaulyc3exg
Message: Message has no valid recipients: all To/Cc are disabled, invalid, or configured not to receive this mail.
PARAMETERS
from: PHID-USER-lqiz3yd7wmk64ejugvov
is-html:
parent-message-id: null
thread-id: differential-rev-PHID-DREV-5bnb33yeuhuaulyc3exg-req
is-first-message: null
is-bulk: 1
mailtags: ["differential-comment"]
cc: ["PHID-USER-cluwcdowc35gmperlkbi"]
subject: D22: quack quack
subject-prefix: [Differential]
vary-subject-prefix: [Commented On]
worker-task: 936546
HEADERS
Thread-Topic: D22: quack quack
X-Herald-Rules: none
X-Differential-Author: <PHID-USER-lqiz3yd7wmk64ejugvov>
X-Differential-CC: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Differential-CC: <PHID-USER-cluwcdowc35gmperlkbi>
X-Differential-CC: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Differential-CC: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Differential-CC: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Differential-CC: <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-CCs: <PHID-USER-ly3pvrtdkw7lbgs72jvr>, <PHID-USER-cluwcdowc35gmperlkbi>, <PHID-MLST-wkxaantg3q6pgdkty5pt>, <PHID-USER-aeabc4ipqbifny3rw4ok>, <PHID-USER-zqxtb3oi4pouwxnxlv3f>, <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-Explicit-CC: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Differential-Explicit-CC: <PHID-USER-cluwcdowc35gmperlkbi>
X-Differential-Explicit-CC: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Differential-Explicit-CC: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Differential-Explicit-CC: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Differential-Explicit-CC: <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-Explicit-CCs: <PHID-USER-ly3pvrtdkw7lbgs72jvr>, <PHID-USER-cluwcdowc35gmperlkbi>, <PHID-MLST-wkxaantg3q6pgdkty5pt>, <PHID-USER-aeabc4ipqbifny3rw4ok>, <PHID-USER-zqxtb3oi4pouwxnxlv3f>, <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Phabricator-To: <PHID-USER-lqiz3yd7wmk64ejugvov>
X-Phabricator-Cc: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Phabricator-Cc: <PHID-USER-cluwcdowc35gmperlkbi>
X-Phabricator-Cc: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Phabricator-Cc: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Phabricator-Cc: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Phabricator-Cc: <PHID-USER-cknqtm2dzw7twnwyiaye>
RECIPIENTS
! dog (dog)
- This user is disabled; disabled users do not receive mail.
BODY
epriestley has commented on the revision "quack quack".
zxcbzxcb
REVISION DETAIL
http://local.aphront.com:8080/D22
To: epriestley
Cc: Unknown User, dog, list, duck, epriestley992, asana
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3306
Differential Revision: https://secure.phabricator.com/D6423
2013-07-11 03:52:22 +02:00
|
|
|
$info[] = null;
|
|
|
|
$info[] = pht('HEADERS');
|
|
|
|
foreach (idx($parameters, 'headers', array()) as $header) {
|
|
|
|
list($name, $value) = $header;
|
|
|
|
$info[] = "{$name}: {$value}";
|
|
|
|
}
|
|
|
|
|
|
|
|
$attachments = idx($parameters, 'attachments');
|
|
|
|
if ($attachments) {
|
|
|
|
$info[] = null;
|
|
|
|
$info[] = pht('ATTACHMENTS');
|
|
|
|
foreach ($attachments as $attachment) {
|
2013-08-30 02:37:17 +02:00
|
|
|
$info[] = idx($attachment, 'filename', pht('Unnamed File'));
|
Move outbound mail lists to CLI and enhance details
Summary: Finish off moving all this stuff to the CLI. Ref T3306.
Test Plan:
PROPERTIES
ID: 6483
Status: void
Retry Count: 0
Next Retry: 1373494457
Related PHID: PHID-DREV-5bnb33yeuhuaulyc3exg
Message: Message has no valid recipients: all To/Cc are disabled, invalid, or configured not to receive this mail.
PARAMETERS
from: PHID-USER-lqiz3yd7wmk64ejugvov
is-html:
parent-message-id: null
thread-id: differential-rev-PHID-DREV-5bnb33yeuhuaulyc3exg-req
is-first-message: null
is-bulk: 1
mailtags: ["differential-comment"]
cc: ["PHID-USER-cluwcdowc35gmperlkbi"]
subject: D22: quack quack
subject-prefix: [Differential]
vary-subject-prefix: [Commented On]
worker-task: 936546
HEADERS
Thread-Topic: D22: quack quack
X-Herald-Rules: none
X-Differential-Author: <PHID-USER-lqiz3yd7wmk64ejugvov>
X-Differential-CC: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Differential-CC: <PHID-USER-cluwcdowc35gmperlkbi>
X-Differential-CC: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Differential-CC: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Differential-CC: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Differential-CC: <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-CCs: <PHID-USER-ly3pvrtdkw7lbgs72jvr>, <PHID-USER-cluwcdowc35gmperlkbi>, <PHID-MLST-wkxaantg3q6pgdkty5pt>, <PHID-USER-aeabc4ipqbifny3rw4ok>, <PHID-USER-zqxtb3oi4pouwxnxlv3f>, <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-Explicit-CC: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Differential-Explicit-CC: <PHID-USER-cluwcdowc35gmperlkbi>
X-Differential-Explicit-CC: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Differential-Explicit-CC: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Differential-Explicit-CC: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Differential-Explicit-CC: <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Differential-Explicit-CCs: <PHID-USER-ly3pvrtdkw7lbgs72jvr>, <PHID-USER-cluwcdowc35gmperlkbi>, <PHID-MLST-wkxaantg3q6pgdkty5pt>, <PHID-USER-aeabc4ipqbifny3rw4ok>, <PHID-USER-zqxtb3oi4pouwxnxlv3f>, <PHID-USER-cknqtm2dzw7twnwyiaye>
X-Phabricator-To: <PHID-USER-lqiz3yd7wmk64ejugvov>
X-Phabricator-Cc: <PHID-USER-ly3pvrtdkw7lbgs72jvr>
X-Phabricator-Cc: <PHID-USER-cluwcdowc35gmperlkbi>
X-Phabricator-Cc: <PHID-MLST-wkxaantg3q6pgdkty5pt>
X-Phabricator-Cc: <PHID-USER-aeabc4ipqbifny3rw4ok>
X-Phabricator-Cc: <PHID-USER-zqxtb3oi4pouwxnxlv3f>
X-Phabricator-Cc: <PHID-USER-cknqtm2dzw7twnwyiaye>
RECIPIENTS
! dog (dog)
- This user is disabled; disabled users do not receive mail.
BODY
epriestley has commented on the revision "quack quack".
zxcbzxcb
REVISION DETAIL
http://local.aphront.com:8080/D22
To: epriestley
Cc: Unknown User, dog, list, duck, epriestley992, asana
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3306
Differential Revision: https://secure.phabricator.com/D6423
2013-07-11 03:52:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$actors = $message->loadAllActors();
|
|
|
|
$actors = array_select_keys(
|
|
|
|
$actors,
|
|
|
|
array_merge($message->getToPHIDs(), $message->getCcPHIDs()));
|
|
|
|
$info[] = null;
|
|
|
|
$info[] = pht('RECIPIENTS');
|
|
|
|
foreach ($actors as $actor) {
|
|
|
|
if ($actor->isDeliverable()) {
|
|
|
|
$info[] = ' '.coalesce($actor->getName(), $actor->getPHID());
|
|
|
|
} else {
|
|
|
|
$info[] = '! '.coalesce($actor->getName(), $actor->getPHID());
|
|
|
|
foreach ($actor->getUndeliverableReasons() as $reason) {
|
|
|
|
$info[] = ' - '.$reason;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-20 19:13:42 +02:00
|
|
|
$info[] = null;
|
|
|
|
$info[] = pht('BODY');
|
|
|
|
$info[] = $message->getBody();
|
|
|
|
|
|
|
|
$console->writeOut('%s', implode("\n", $info));
|
|
|
|
|
|
|
|
if ($message_key != $last_key) {
|
|
|
|
$console->writeOut("\n%s\n\n", str_repeat('-', 80));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|