1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-16 03:42:41 +01:00
phorge-phorge/src/applications/metamta/storage/PhabricatorMetaMTAAttachment.php
epriestley e80c59cbc6 Introduce basic bin/mail with a resend workflow
Summary:
Fixes T2458. Ref T2843. @tido's email from T2843 has exhausted its retries and failed, but we want to try it again with the patch from D5464 to capture the actual error. This sort of thing has come up a few times in debugging, too.

Also fixed some stuff that came up while debugging this.

Test Plan:
  - Ran command with no args.
  - Ran resend with no args.
  - Ran resend with bad IDs.
  - Ran resend with already-queued messages, got "already queued" error.
  - Ran resend with already-sent message, got requeue.

Reviewers: btrahan, tido

Reviewed By: tido

CC: aran

Maniphest Tasks: T2458, T2843

Differential Revision: https://secure.phabricator.com/D5493
2013-03-30 15:53:49 -07:00

56 lines
1.1 KiB
PHP

<?php
final class PhabricatorMetaMTAAttachment {
protected $data;
protected $filename;
protected $mimetype;
public function __construct($data, $filename, $mimetype) {
$this->setData($data);
$this->setFilename($filename);
$this->setMimeType($mimetype);
}
public function getData() {
return $this->data;
}
public function setData($data) {
$this->data = $data;
return $this;
}
public function getFilename() {
return $this->filename;
}
public function setFilename($filename) {
$this->filename = $filename;
return $this;
}
public function getMimeType() {
return $this->mimetype;
}
public function setMimeType($mimetype) {
$this->mimetype = $mimetype;
return $this;
}
public function toDictionary() {
return array(
'filename' => $this->getFilename(),
'mimetype' => $this->getMimetype(),
'data' => $this->getData(),
);
}
public static function newFromDictionary(array $dict) {
return new PhabricatorMetaMTAAttachment(
idx($dict, 'data'),
idx($dict, 'filename'),
idx($dict, 'mimetype'));
}
}