asdad
This commit is contained in:
@@ -696,6 +696,7 @@ class ApiKernel
|
||||
if ($blk !== null && in_array('block_id', $allCols, true)) $data['block_id'] = $blk;
|
||||
|
||||
if ($updCol) $data[$updCol] = date('Y-m-d H:i:s');
|
||||
$this->debugSavePayload($kind, $id, $html, $json);
|
||||
if (!$data) $this->fail('nothing to update', null, 422);
|
||||
|
||||
[$tw, $tp] = $this->tenantWhere($auth);
|
||||
@@ -903,6 +904,27 @@ class ApiKernel
|
||||
}
|
||||
}
|
||||
|
||||
private function debugSavePayload(string $kind, $id, $html, $json): void
|
||||
{
|
||||
if (empty($this->in['debug'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$payload = [
|
||||
'time' => date(DATE_ATOM),
|
||||
'kind' => $kind,
|
||||
'id' => $id,
|
||||
'html_length' => is_string($html) ? strlen($html) : null,
|
||||
'json_length' => is_string($json) ? strlen($json) : null,
|
||||
'html_preview' => is_string($html) ? substr($html, 0, 200) : null,
|
||||
'json_preview' => is_string($json) ? substr($json, 0, 200) : null,
|
||||
'json_is_empty' => is_string($json) ? trim($json) === '' : ($json === null),
|
||||
];
|
||||
|
||||
$line = json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n";
|
||||
@file_put_contents(sys_get_temp_dir() . '/emailtemplate_debug_save.log', $line, FILE_APPEND);
|
||||
}
|
||||
|
||||
private function replacePlaceholders(string $html, array $placeholders): string
|
||||
{
|
||||
if ($html === '' || !$placeholders) {
|
||||
|
||||
Reference in New Issue
Block a user