From 80eb0f0eb1afa4789ab1cb5db84400ff73bbaa3f Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 5 May 2011 15:11:36 -0700 Subject: [PATCH] Fix a small inbound email glitch Summary: Sendmail isn't actually OK with passing ENV stuff via 'aliases', accept it as an argument instead. Test Plan: Sent real email to a real server, got differential updates! Reviewed By: jungejason Reviewers: jungejason, tuomaspelkonen, aran CC: aran, jungejason Differential Revision: 233 --- scripts/__init_env__.php | 4 +++- scripts/mail/mail_handler.php | 4 ++++ src/docs/configuring_inbound_email.diviner | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/__init_env__.php b/scripts/__init_env__.php index 8925464937..faf5fedcea 100644 --- a/scripts/__init_env__.php +++ b/scripts/__init_env__.php @@ -21,7 +21,9 @@ ini_set('include_path', $include_path.':'.dirname(__FILE__).'/../../'); require_once dirname(dirname(__FILE__)).'/conf/__init_conf__.php'; -$env = getenv('PHABRICATOR_ENV'); +$env = isset($_SERVER['PHABRICATOR_ENV']) + ? $_SERVER['PHABRICATOR_ENV'] + : getenv('PHABRICATOR_ENV'); if (!$env) { echo "Define PHABRICATOR_ENV before running this script.\n"; exit(1); diff --git a/scripts/mail/mail_handler.php b/scripts/mail/mail_handler.php index f2f5412e75..001a03491b 100755 --- a/scripts/mail/mail_handler.php +++ b/scripts/mail/mail_handler.php @@ -17,6 +17,10 @@ * limitations under the License. */ +if ($argc > 1) { + $_SERVER['PHABRICATOR_ENV'] = $argv[1]; +} + $root = dirname(dirname(dirname(__FILE__))); require_once $root.'/scripts/__init_script__.php'; require_once $root.'/scripts/__init_env__.php'; diff --git a/src/docs/configuring_inbound_email.diviner b/src/docs/configuring_inbound_email.diviner index 900e87ae73..f3ead1557a 100644 --- a/src/docs/configuring_inbound_email.diviner +++ b/src/docs/configuring_inbound_email.diviner @@ -47,7 +47,7 @@ probably means something like this: Now, you can actually configure sendmail to deliver to Phabricator. In ##/etc/aliases##, add an entry like this: - phabricator: "| PHABRICATOR_ENV= /path/to/phabricator/scripts/mail/mail_handler.php" + phabricator: "| /path/to/phabricator/scripts/mail/mail_handler.php " ...where is the PHABRICATOR_ENV the script should run under. Run ##sudo newaliases##. Now you likely need to symlink this script into