diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a20998..d21859c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ It is a summary of changes that would be pertinent to the end user of the PGEtin - Added support to deploy on subpaths - Added updated version of PGE, Extensions, and Utlities - Fixed patreon supporters not updated after PGEtinker upgrades +- Added filters for compiler output ## 2024-05-14 diff --git a/app/Http/Controllers/CodeController.php b/app/Http/Controllers/CodeController.php index 01d553c..1117357 100644 --- a/app/Http/Controllers/CodeController.php +++ b/app/Http/Controllers/CodeController.php @@ -192,12 +192,6 @@ function compileCode($code) ]; } - function filterOutput($text) - { - $text = str_replace("/opt/emsdk/upstream/emscripten/cache/sysroot", "/***", $text); - return $text; - } - } diff --git a/pgetinker/Compiler.php b/pgetinker/Compiler.php index 53a72e0..f83d147 100644 --- a/pgetinker/Compiler.php +++ b/pgetinker/Compiler.php @@ -93,14 +93,20 @@ public function setWorkingDirectory(string $workingDirectory) return $this; } - public function getOutput() + public function getOutput($raw = false) { - return implode("\n", $this->output); + if($raw) + return implode("\n", $this->output); + + return str_replace("/opt/emsdk/upstream/emscripten/cache/sysroot", "/***", implode("\n", $this->output)); } - public function getErrorOutput() + public function getErrorOutput($raw = false) { - return implode("\n", $this->errors); + if($raw) + return implode("\n", $this->errors); + + return str_replace("/opt/emsdk/upstream/emscripten/cache/sysroot", "/***", implode("\n", $this->errors)); } public function getHtml() @@ -514,7 +520,7 @@ private function link() private function cleanUp() { - $this->logger->info("OUTPUT:\n\n" . $this->getOutput() . "\n\nERROR:\n\n" . $this->getErrorOutput()); + $this->logger->info("OUTPUT:\n\n" . $this->getOutput(true) . "\n\nERROR:\n\n" . $this->getErrorOutput(true)); Log::info("Compile: finished disgracefully"); }