From 57600b0e22fa9557217b6a2a2d99aa55b1a89d61 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Thu, 18 May 2023 19:11:35 -0300 Subject: [PATCH] Tweak gravity to show the new parse list output Replaces every `\r` returned by `pihole-FTL gravity parseList` with a known string to allow overwriting the previous line. Signed-off-by: RD WebDesign --- scripts/pi-hole/php/gravity.sh.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/pi-hole/php/gravity.sh.php b/scripts/pi-hole/php/gravity.sh.php index e7c3323d3..0abf5ec88 100644 --- a/scripts/pi-hole/php/gravity.sh.php +++ b/scripts/pi-hole/php/gravity.sh.php @@ -22,7 +22,14 @@ function echoEvent($datatext) { // Detect ${OVER} and replace it with something we can safely transmit + // This allows every line (including progress and error messages) to be shown on the page + + // Replace "\r" (generated by gravity.sh) with "<------" $datatext = str_replace("\r", '<------', $datatext); + + // Replace "\r" generated by "pihole-FTL gravity parseList" command + $datatext = str_replace("\r", '<------', $datatext); + $pos = strpos($datatext, '<------'); // Detect if the ${OVER} line is within this line, e.g. // "Pending: String to replace${OVER}Done: String has been replaced"