fer
This commit is contained in:
@@ -2357,7 +2357,11 @@ class ApiKernel
|
|||||||
'html_length' => strlen($html),
|
'html_length' => strlen($html),
|
||||||
'mail_error' => $this->lastMailError,
|
'mail_error' => $this->lastMailError,
|
||||||
]);
|
]);
|
||||||
$this->fail('Send failed', null, 500);
|
$detail = null;
|
||||||
|
if ($this->isStagingEnv()) {
|
||||||
|
$detail = ['mail_error' => $this->lastMailError];
|
||||||
|
}
|
||||||
|
$this->fail('Send failed', $detail, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($customerId > 0) {
|
if ($customerId > 0) {
|
||||||
@@ -5816,20 +5820,8 @@ SQL;
|
|||||||
|
|
||||||
private function writeDebugLog(string $name, array $payload): void
|
private function writeDebugLog(string $name, array $payload): void
|
||||||
{
|
{
|
||||||
$env = strtolower((string)($this->conf['env'] ?? ''));
|
if (!$this->isStagingEnv()) {
|
||||||
if ($env !== 'staging' && (!defined('APP_ENV') || strtolower((string)APP_ENV) !== 'staging')) {
|
return;
|
||||||
$host = '';
|
|
||||||
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
|
||||||
$host = strtolower(trim(explode(',', (string)$_SERVER['HTTP_X_FORWARDED_HOST'])[0]));
|
|
||||||
} elseif (!empty($_SERVER['HTTP_HOST'])) {
|
|
||||||
$host = strtolower((string)$_SERVER['HTTP_HOST']);
|
|
||||||
}
|
|
||||||
if ($host !== '') {
|
|
||||||
$host = preg_replace('/:\\d+$/', '', $host);
|
|
||||||
}
|
|
||||||
if ($host !== 'staging.emailtemplate.it') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$dir = $this->debugDir();
|
$dir = $this->debugDir();
|
||||||
debug_log_write($name, $payload, [
|
debug_log_write($name, $payload, [
|
||||||
@@ -5840,6 +5832,23 @@ SQL;
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function isStagingEnv(): bool
|
||||||
|
{
|
||||||
|
$env = strtolower((string)($this->conf['env'] ?? ''));
|
||||||
|
if ($env === 'staging') return true;
|
||||||
|
if (defined('APP_ENV') && strtolower((string)APP_ENV) === 'staging') return true;
|
||||||
|
$host = '';
|
||||||
|
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||||
|
$host = strtolower(trim(explode(',', (string)$_SERVER['HTTP_X_FORWARDED_HOST'])[0]));
|
||||||
|
} elseif (!empty($_SERVER['HTTP_HOST'])) {
|
||||||
|
$host = strtolower((string)$_SERVER['HTTP_HOST']);
|
||||||
|
}
|
||||||
|
if ($host !== '') {
|
||||||
|
$host = preg_replace('/:\\d+$/', '', $host);
|
||||||
|
}
|
||||||
|
return $host === 'staging.emailtemplate.it';
|
||||||
|
}
|
||||||
|
|
||||||
private function defaultApiBase(): string
|
private function defaultApiBase(): string
|
||||||
{
|
{
|
||||||
$base = $this->conf['base_url'] ?? '';
|
$base = $this->conf['base_url'] ?? '';
|
||||||
|
|||||||
Reference in New Issue
Block a user