Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/metamta/PhabricatorMetaMTAWorker.php b/src/applications/metamta/PhabricatorMetaMTAWorker.php
index f3075033b3..50e0b38230 100644
--- a/src/applications/metamta/PhabricatorMetaMTAWorker.php
+++ b/src/applications/metamta/PhabricatorMetaMTAWorker.php
@@ -1,51 +1,52 @@
<?php
final class PhabricatorMetaMTAWorker
extends PhabricatorWorker {
private $message;
public function getWaitBeforeRetry(PhabricatorWorkerTask $task) {
$message = $this->loadMessage();
if (!$message) {
return null;
}
$wait = max($message->getNextRetry() - time(), 0) + 15;
return $wait;
}
public function doWork() {
$message = $this->loadMessage();
if (!$message
|| $message->getStatus() != PhabricatorMetaMTAMail::STATUS_QUEUE) {
return;
}
$id = $message->getID();
$message->sendNow();
// task failed if the message is still queued
// (instead of sent, void, or failed)
if ($message->getStatus() == PhabricatorMetaMTAMail::STATUS_QUEUE) {
throw new Exception('Failed to send message');
}
}
private function loadMessage() {
if (!$this->message) {
$message_id = $this->getTaskData();
$this->message = id(new PhabricatorMetaMTAMail())->load($message_id);
if (!$this->message) {
return null;
}
}
return $this->message;
}
public function renderForDisplay() {
return phutil_tag(
- 'a',
- array('href' => '/mail/view/'.$this->getTaskData().'/'),
- $this->getTaskData());
+ 'pre',
+ array(
+ ),
+ 'phabricator/ $ ./bin/mail show-outbound --id '.$this->getTaskData());
}
}
diff --git a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
index 81967b2bdb..8ab0a973e4 100644
--- a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
@@ -1,126 +1,126 @@
<?php
final class PhabricatorMailManagementShowOutboundWorkflow
extends PhabricatorSearchManagementWorkflow {
protected function didConstruct() {
$this
->setName('show-outbound')
->setSynopsis('Show diagnostic details about outbound mail.')
->setExamples(
"**show-outbound** --id 1 --id 2")
->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(
"Some specified messages do not exist: ".
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('Retry Count: %s', $message->getRetryCount());
$info[] = pht('Next Retry: %s', $message->getNextRetry());
$info[] = pht('Related PHID: %s', $message->getRelatedPHID());
$info[] = pht('Message: %s', $message->getMessage());
$info[] = null;
$info[] = pht('PARAMETERS');
$parameters = $message->getParameters();
foreach ($parameters as $key => $value) {
if ($key == 'body') {
continue;
}
if ($key == 'headers') {
continue;
}
if ($key == 'attachments') {
continue;
}
if (!is_scalar($value)) {
$value = json_encode($value);
}
$info[] = pht('%s: %s', $key, $value);
}
$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) {
- $info[] = $attachment['filename'];
+ $info[] = idx($attachment, 'filename', pht('Unnamed File'));
}
}
$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;
}
}
}
$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));
}
}
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Nov 5, 9:42 PM (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
321267
Default Alt Text
(5 KB)

Event Timeline