Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/config/check/PhabricatorMailSetupCheck.php b/src/applications/config/check/PhabricatorMailSetupCheck.php
index 2b8e4e12d5..b3b6143ad0 100644
--- a/src/applications/config/check/PhabricatorMailSetupCheck.php
+++ b/src/applications/config/check/PhabricatorMailSetupCheck.php
@@ -1,100 +1,104 @@
<?php
final class PhabricatorMailSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() {
+ if (PhabricatorEnv::getEnvConfig('cluster.mailers')) {
+ return;
+ }
+
$adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter');
switch ($adapter) {
case 'PhabricatorMailImplementationPHPMailerLiteAdapter':
if (!Filesystem::pathExists('/usr/bin/sendmail') &&
!Filesystem::pathExists('/usr/sbin/sendmail')) {
$message = pht(
'Mail is configured to send via sendmail, but this system has '.
'no sendmail binary. Install sendmail or choose a different '.
'mail adapter.');
$this->newIssue('config.metamta.mail-adapter')
->setShortName(pht('Missing Sendmail'))
->setName(pht('No Sendmail Binary Found'))
->setMessage($message)
->addRelatedPhabricatorConfig('metamta.mail-adapter');
}
break;
case 'PhabricatorMailImplementationAmazonSESAdapter':
if (PhabricatorEnv::getEnvConfig('metamta.can-send-as-user')) {
$message = pht(
'Amazon SES does not support sending email as users. Disable '.
'send as user, or choose a different mail adapter.');
$this->newIssue('config.can-send-as-user')
->setName(pht("SES Can't Send As User"))
->setMessage($message)
->addRelatedPhabricatorConfig('metamta.mail-adapter')
->addPhabricatorConfig('metamta.can-send-as-user');
}
if (!PhabricatorEnv::getEnvConfig('amazon-ses.access-key')) {
$message = pht(
'Amazon SES is selected as the mail adapter, but no SES access '.
'key is configured. Provide an SES access key, or choose a '.
'different mail adapter.');
$this->newIssue('config.amazon-ses.access-key')
->setName(pht('Amazon SES Access Key Not Set'))
->setMessage($message)
->addRelatedPhabricatorConfig('metamta.mail-adapter')
->addPhabricatorConfig('amazon-ses.access-key');
}
if (!PhabricatorEnv::getEnvConfig('amazon-ses.secret-key')) {
$message = pht(
'Amazon SES is selected as the mail adapter, but no SES secret '.
'key is configured. Provide an SES secret key, or choose a '.
'different mail adapter.');
$this->newIssue('config.amazon-ses.secret-key')
->setName(pht('Amazon SES Secret Key Not Set'))
->setMessage($message)
->addRelatedPhabricatorConfig('metamta.mail-adapter')
->addPhabricatorConfig('amazon-ses.secret-key');
}
if (!PhabricatorEnv::getEnvConfig('amazon-ses.endpoint')) {
$message = pht(
'Amazon SES is selected as the mail adapter, but no SES endpoint '.
'is configured. Provide an SES endpoint or choose a different '.
'mail adapter.');
$this->newIssue('config.amazon-ses.endpoint')
->setName(pht('Amazon SES Endpoint Not Set'))
->setMessage($message)
->addRelatedPhabricatorConfig('metamta.mail-adapter')
->addPhabricatorConfig('amazon-ses.endpoint');
}
$address_key = 'metamta.default-address';
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
$default = $options[$address_key]->getDefault();
$value = PhabricatorEnv::getEnvConfig($address_key);
if ($default === $value) {
$message = pht(
'Amazon SES requires verification of the "From" address, but '.
'you have not configured a "From" address. Configure and verify '.
'a "From" address, or choose a different mail adapter.');
$this->newIssue('config.metamta.default-address')
->setName(pht('No SES From Address Configured'))
->setMessage($message)
->addRelatedPhabricatorConfig('metamta.mail-adapter')
->addPhabricatorConfig('metamta.default-address');
}
break;
}
}
}
diff --git a/src/infrastructure/cluster/config/PhabricatorClusterMailersConfigType.php b/src/infrastructure/cluster/config/PhabricatorClusterMailersConfigType.php
index 2a7550c419..b3b110298f 100644
--- a/src/infrastructure/cluster/config/PhabricatorClusterMailersConfigType.php
+++ b/src/infrastructure/cluster/config/PhabricatorClusterMailersConfigType.php
@@ -1,100 +1,100 @@
<?php
final class PhabricatorClusterMailersConfigType
extends PhabricatorJSONConfigType {
const TYPEKEY = 'cluster.mailers';
public function validateStoredValue(
PhabricatorConfigOption $option,
$value) {
if ($value === null) {
return;
}
if (!is_array($value)) {
throw $this->newException(
pht(
'Mailer cluster configuration is not valid: it should be a list '.
'of mailer configurations.'));
}
foreach ($value as $index => $spec) {
if (!is_array($spec)) {
throw $this->newException(
pht(
'Mailer cluster configuration is not valid: each entry in the '.
'list must be a dictionary describing a mailer, but the value '.
'with index "%s" is not a dictionary.',
$index));
}
}
$adapters = PhabricatorMailImplementationAdapter::getAllAdapters();
$map = array();
foreach ($value as $index => $spec) {
try {
PhutilTypeSpec::checkMap(
$spec,
array(
'key' => 'string',
'type' => 'string',
'priority' => 'optional int',
'options' => 'optional wild',
));
} catch (Exception $ex) {
throw $this->newException(
pht(
'Mailer configuration has an invalid mailer specification '.
'(at index "%s"): %s.',
$index,
$ex->getMessage()));
}
$key = $spec['key'];
if (isset($map[$key])) {
throw $this->newException(
pht(
'Mailer configuration is invalid: multiple mailers have the same '.
'key ("%s"). Each mailer must have a unique key.',
$key));
}
$map[$key] = true;
- $priority = idx($spec, 'priority', 0);
- if ($priority <= 0) {
+ $priority = idx($spec, 'priority');
+ if ($priority !== null && $priority <= 0) {
throw $this->newException(
pht(
'Mailer configuration ("%s") is invalid: priority must be '.
'greater than 0.',
$key));
}
$type = $spec['type'];
if (!isset($adapters[$type])) {
throw $this->newException(
pht(
'Mailer configuration ("%s") is invalid: mailer type ("%s") is '.
'unknown. Supported mailer types are: %s.',
$key,
$type,
implode(', ', array_keys($adapters))));
}
$options = idx($spec, 'options', array());
try {
id(clone $adapters[$type])->validateOptions($options);
} catch (Exception $ex) {
throw $this->newException(
pht(
'Mailer configuration ("%s") specifies invalid options for '.
'mailer: %s',
$key,
$ex->getMessage()));
}
}
}
}

File Metadata

Mime Type
text/x-diff
Expires
Jan 19 2025, 20:50 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128613
Default Alt Text
(7 KB)

Event Timeline