1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Improve messaging and setup process for configuring outbound email.

Summary:
- Make the instructional text generally more useful.
  - Show the current configured adapter.
  - When the configuration prevents outbound email from being delivered, show a
warning.
  - Detect 'curl' extension during setup since it's more-or-less required
  - Add curl extension to the install scripts

codeblock: can you verify the rhel-derivs changes are correct?

Test Plan:
Set adapter to test, verified warning; entered setup mode and verified curl. Ran
apt-get on an ubuntu box. Ran yum on an amazon linux box.

Reviewed By: toulouse
Reviewers: toulouse, codeblock
Commenters: codeblock
CC: aran, jungejason, tuomaspelkonen, codeblock, epriestley, toulouse
Differential Revision: 438
This commit is contained in:
epriestley 2011-06-12 20:16:34 -07:00
parent fedbd475b5
commit d710fc097f
4 changed files with 46 additions and 4 deletions

View file

@ -37,7 +37,7 @@ echo
set +x
sudo apt-get -qq update
sudo apt-get install git mysql-server apache2 php5 php5-mysql php5-gd php5-dev php-apc dpkg-dev
sudo apt-get install git mysql-server apache2 php5 php5-mysql php5-gd php5-dev php5-curl php-apc dpkg-dev
HAVEPCNTL=`php -r "echo extension_loaded('pcntl');"`
if [ $HAVEPCNTL != "1" ]

View file

@ -45,14 +45,44 @@ class PhabricatorMetaMTASendController extends PhabricatorMetaMTAController {
"Enter a number to simulate that many consecutive send failures before ".
"really attempting to deliver via the underlying MTA.";
$doclink_href = PhabricatorEnv::getDoclink(
'article/Configuring_Outbound_Email.html');
$doclink = phutil_render_tag(
'a',
array(
'href' => $doclink_href,
'target' => '_blank',
),
'Configuring Outbound Email');
$instructions =
'<p class="aphront-form-instructions">This form will send a normal '.
'email using the settings you have configured for Phabricator. For more '.
'information, see '.$doclink.'.</p>';
$adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter');
$warning = null;
if ($adapter == 'PhabricatorMailImplementationTestAdapter') {
$warning = new AphrontErrorView();
$warning->setTitle('Email is Disabled');
$warning->setSeverity(AphrontErrorView::SEVERITY_WARNING);
$warning->appendChild(
'<p>This installation of Phabricator is currently set to use '.
'<tt>PhabricatorMailImplementationTestAdapter</tt> to deliver '.
'outbound email. This completely disables outbound email! All '.
'outbound email will be thrown in a deep, dark hole until you '.
'configure a real adapter.</p>');
}
$form = new AphrontFormView();
$form->setUser($request->getUser());
$form->setAction('/mail/send/');
$form
->appendChild($instructions)
->appendChild(
'<p class="aphront-form-instructions">This form will send a normal '.
'email using MetaMTA as a transport mechanism.</p>')
id(new AphrontFormStaticControl())
->setLabel('Configured Adapter')
->setValue($adapter))
->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel('To')
@ -97,7 +127,10 @@ class PhabricatorMetaMTASendController extends PhabricatorMetaMTAController {
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
return $this->buildStandardPageResponse(
$panel,
array(
$warning,
$panel,
),
array(
'title' => 'Send Mail',
));

View file

@ -9,14 +9,18 @@
phutil_require_module('phabricator', 'aphront/response/redirect');
phutil_require_module('phabricator', 'applications/metamta/controller/base');
phutil_require_module('phabricator', 'applications/metamta/storage/mail');
phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phabricator', 'view/form/base');
phutil_require_module('phabricator', 'view/form/control/checkbox');
phutil_require_module('phabricator', 'view/form/control/static');
phutil_require_module('phabricator', 'view/form/control/submit');
phutil_require_module('phabricator', 'view/form/control/text');
phutil_require_module('phabricator', 'view/form/control/textarea');
phutil_require_module('phabricator', 'view/form/control/tokenizer');
phutil_require_module('phabricator', 'view/form/error');
phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');

View file

@ -37,6 +37,11 @@ class PhabricatorSetup {
'hash',
'json',
'openssl',
// There is a chance we might not need this, but some configurations (like
// Amazon SES) will require it. Just mark it 'required' since it's widely
// available and relatively core.
'curl',
);
foreach ($extensions as $extension) {
$ok = self::requireExtension($extension);