From fb1522a16802fd2fa80c9bc800455f63fc7da853 Mon Sep 17 00:00:00 2001 From: "@s.odnoletko" Date: Sat, 13 Mar 2021 16:36:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=20response=20=D0=BF=D1=80=D0=BE=D1=86?= =?UTF-8?q?=D0=B5=D1=81=D1=81=D0=BE=D1=80=D0=B0=20mgr/get=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20=D1=81=20?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D0=B0=D1=80=D1=81=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=BC=D0=B8=20=D0=BB=D0=BE=D0=B3=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controlerrorlog/processors/mgr/get.class.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/components/controlerrorlog/processors/mgr/get.class.php b/core/components/controlerrorlog/processors/mgr/get.class.php index 6947712..e0fd900 100644 --- a/core/components/controlerrorlog/processors/mgr/get.class.php +++ b/core/components/controlerrorlog/processors/mgr/get.class.php @@ -33,7 +33,7 @@ public function process() $tooLarge = false; $lastLines = (int)$this->modx->getOption('controlerrorlog.last_lines', null, 15); $formatOutput = $this->modx->getOption('controlerrorlog.format_output', null, true); - + $logsArray = []; if (file_exists($this->file)) { $size = $this->getSize(true); if ($this->size >= 1048576) { @@ -42,9 +42,12 @@ public function process() $content = $this->getLastLines($lastLines); } } else { - $content = $formatOutput - ? $this->getContent($this->file) - : file_get_contents($this->file); + if($formatOutput){ + $content = $this->getContent($this->file)['render']; + $logsArray = $this->getContent($this->file)['prepared']; + }else{ + $content = file_get_contents($this->file); + } } if ($this->getSize() > 0) { $empty = false; @@ -62,6 +65,7 @@ public function process() 'refresh_freq' => $this->modx->getOption('controlerrorlog.refresh_freq', null, 60) * 1000, 'connector_url' => $connector_url, 'log' => $includeContent ? $content : '', + 'logsArray'=> $logsArray, 'allow_copy_deletion' => (bool)$this->modx->getOption('controlerrorlog.allow_copy_deletion', null, true), 'messages_count' => $this->count ?: 0, 'format_output' => (bool)$formatOutput, @@ -75,7 +79,7 @@ public function process() /** * @param string $file - * @return string + * @return array */ protected function getContent($file) { @@ -106,7 +110,7 @@ protected function getContent($file) $messages[] = $logMessage; } - return $this->render($messages); + return ['prepared'=>$messages,'render'=> $this->render($messages)]; } /**