Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14415942
D7760.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D7760.diff
View Options
Index: scripts/mail/mail_handler.php
===================================================================
--- scripts/mail/mail_handler.php
+++ scripts/mail/mail_handler.php
@@ -1,14 +1,37 @@
#!/usr/bin/env php
<?php
+// NOTE: This script is very oldschool and takes the environment as an argument.
+// Some day, we could take a shot at cleaning this up.
if ($argc > 1) {
- $_SERVER['PHABRICATOR_ENV'] = $argv[1];
+ foreach (array_slice($argv, 1) as $arg) {
+ if (!preg_match('/^-/', $arg)) {
+ $_SERVER['PHABRICATOR_ENV'] = $arg;
+ break;
+ }
+ }
}
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
require_once $root.'/externals/mimemailparser/MimeMailParser.class.php';
+$args = new PhutilArgumentParser($argv);
+$args->parseStandardArguments();
+$args->parse(
+ array(
+ array(
+ 'name' => 'process-duplicates',
+ 'help' => pht(
+ "Process this message, even if it's a duplicate of another message. ".
+ "This is mostly useful when debugging issues with mail routing."),
+ ),
+ array(
+ 'name' => 'env',
+ 'wildcard' => true,
+ ),
+ ));
+
$parser = new MimeMailParser();
$parser->setText(file_get_contents('php://stdin'));
@@ -28,6 +51,10 @@
$headers['subject'] = iconv_mime_decode($headers['subject'], 0, "UTF-8");
$headers['from'] = iconv_mime_decode($headers['from'], 0, "UTF-8");
+if ($args->getArg('process-duplicates')) {
+ $headers['message-id'] = Filesystem::readRandomCharacters(64);
+}
+
$received = new PhabricatorMetaMTAReceivedMail();
$received->setHeaders($headers);
$received->setBodies(array(
@@ -62,6 +89,8 @@
$received
->setMessage('EXCEPTION: '.$e->getMessage())
->save();
+
+ throw $e;
}
Index: src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php
===================================================================
--- src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php
+++ src/applications/conpherence/mail/ConpherenceCreateThreadMailReceiver.php
@@ -53,13 +53,15 @@
$phids = mpull($users, 'getPHID');
$conpherence = id(new ConpherenceReplyHandler())
- ->setMailReceiver(new ConpherenceThread())
+ ->setMailReceiver(ConpherenceThread::initializeNewThread($sender))
->setMailAddedParticipantPHIDs($phids)
->setActor($sender)
->setExcludeMailRecipientPHIDs($mail->loadExcludeMailRecipientPHIDs())
->processEmail($mail);
- $mail->setRelatedPHID($conpherence->getPHID());
+ if ($conpherence) {
+ $mail->setRelatedPHID($conpherence->getPHID());
+ }
}
}
Index: src/applications/conpherence/storage/ConpherenceThread.php
===================================================================
--- src/applications/conpherence/storage/ConpherenceThread.php
+++ src/applications/conpherence/storage/ConpherenceThread.php
@@ -18,6 +18,12 @@
private $widgetData = self::ATTACHABLE;
private $images = array();
+ public function initializeNewThread(PhabricatorUser $sender) {
+ return id(new ConpherenceThread())
+ ->setMessageCount(0)
+ ->setTitle('');
+ }
+
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 7:40 PM (11 h, 10 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6927530
Default Alt Text
D7760.diff (3 KB)
Attached To
Mode
D7760: Fix two issues with creating Conpherence threads via mail on some configurations
Attached
Detach File
Event Timeline
Log In to Comment