Replace literal w/ RASPI_DEBUG_LOG

This commit is contained in:
billz
2023-10-31 22:18:23 +00:00
parent 98d5f5b64b
commit 86ac3e2ff6
4 changed files with 7 additions and 6 deletions

View File

@@ -7,17 +7,16 @@ if (isset($_POST['csrf_token'])) {
if (csrfValidateRequest() && !CSRFValidate()) {
handleInvalidCSRFToken();
}
exec( RASPI_CONFIG.'/system/debuglog.sh', $return);
$root = getenv("DOCUMENT_ROOT");
exec( RASPI_CONFIG.'/system/debuglog.sh -i '.$root, $return);
$logOutput = implode(PHP_EOL, $return);
$filename = "raspap_debug.log";
$tempDir = sys_get_temp_dir();
$filePath = $tempDir . DIRECTORY_SEPARATOR . $filename;
$filePath = $tempDir . DIRECTORY_SEPARATOR . RASPI_DEBUG_LOG;
$handle = fopen($filePath, "w");
fwrite($handle, $logOutput);
fclose($handle);
echo json_encode($filePath);
} else {
handleInvalidCSRFToken();
}