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) {
|
||||||
@@ -5815,9 +5819,24 @@ SQL;
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function writeDebugLog(string $name, array $payload): void
|
private function writeDebugLog(string $name, array $payload): void
|
||||||
|
{
|
||||||
|
if (!$this->isStagingEnv()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$dir = $this->debugDir();
|
||||||
|
debug_log_write($name, $payload, [
|
||||||
|
'dir' => $dir,
|
||||||
|
'append' => false,
|
||||||
|
'json' => true,
|
||||||
|
'newline' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function isStagingEnv(): bool
|
||||||
{
|
{
|
||||||
$env = strtolower((string)($this->conf['env'] ?? ''));
|
$env = strtolower((string)($this->conf['env'] ?? ''));
|
||||||
if ($env !== 'staging' && (!defined('APP_ENV') || strtolower((string)APP_ENV) !== 'staging')) {
|
if ($env === 'staging') return true;
|
||||||
|
if (defined('APP_ENV') && strtolower((string)APP_ENV) === 'staging') return true;
|
||||||
$host = '';
|
$host = '';
|
||||||
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
|
||||||
$host = strtolower(trim(explode(',', (string)$_SERVER['HTTP_X_FORWARDED_HOST'])[0]));
|
$host = strtolower(trim(explode(',', (string)$_SERVER['HTTP_X_FORWARDED_HOST'])[0]));
|
||||||
@@ -5827,17 +5846,7 @@ SQL;
|
|||||||
if ($host !== '') {
|
if ($host !== '') {
|
||||||
$host = preg_replace('/:\\d+$/', '', $host);
|
$host = preg_replace('/:\\d+$/', '', $host);
|
||||||
}
|
}
|
||||||
if ($host !== 'staging.emailtemplate.it') {
|
return $host === 'staging.emailtemplate.it';
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$dir = $this->debugDir();
|
|
||||||
debug_log_write($name, $payload, [
|
|
||||||
'dir' => $dir,
|
|
||||||
'append' => false,
|
|
||||||
'json' => true,
|
|
||||||
'newline' => true,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function defaultApiBase(): string
|
private function defaultApiBase(): string
|
||||||
|
|||||||
Reference in New Issue
Block a user