log irgendwas

This commit is contained in:
2026-02-03 01:15:59 +01:00
parent 11936a4b71
commit 42f49f275e
3 changed files with 24 additions and 3 deletions

View File

@@ -4895,7 +4895,7 @@ SQL;
private function debugDir(): string
{
return dirname(__DIR__) . '/debug';
return rtrim(sys_get_temp_dir(), '/') . '/emailtemplate_debug';
}
private function writeDebugLog(string $name, array $payload): void
@@ -4917,12 +4917,14 @@ SQL;
}
$dir = $this->debugDir();
if (!is_dir($dir)) {
@mkdir($dir, 0775, true);
@mkdir($dir, 0777, true);
}
@chmod($dir, 0777);
$safeName = preg_replace('/[^a-zA-Z0-9_\.\-]/', '_', $name) ?: 'debug';
$file = rtrim($dir, '/') . '/' . $safeName . '.log';
$data = json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
@file_put_contents($file, $data ?: '');
@chmod($file, 0666);
$fallback = sys_get_temp_dir() . '/emailtemplate_debug.log';
$line = json_encode([