From 722e24f81a16084913d23e62e8e09904246ced30 Mon Sep 17 00:00:00 2001 From: bugalot Date: Fri, 22 Nov 2024 13:31:00 +0100 Subject: [PATCH 1/5] fix: update wp-cli/php-cli-tools to 0.12.1 to make CLI work. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 09f58a1e6..29b813e7c 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "league/flysystem": "^1.0|2.1.1|^3.0", "league/mime-type-detection": "^1.0", "oat-sa/lib-beeme": "0.2.0", - "wp-cli/php-cli-tools": "0.10.3" + "wp-cli/php-cli-tools": "0.12.1" }, "require-dev": { "phpunit/phpunit": "~9|~7", From 6be26fec0b7052cd7a3460c603d259b182a1e741 Mon Sep 17 00:00:00 2001 From: bugalot Date: Fri, 22 Nov 2024 13:32:03 +0100 Subject: [PATCH 2/5] fix: Render CLI command broken from a previous change. --- src/qtism/cli/Render.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qtism/cli/Render.php b/src/qtism/cli/Render.php index 259e9711f..983d020e5 100644 --- a/src/qtism/cli/Render.php +++ b/src/qtism/cli/Render.php @@ -280,14 +280,14 @@ private function runGoldilocks(XmlDocument $doc, GoldilocksRenderingEngine $rend $body = substr($body, 0, strlen('') * -1); $body = "{$nl}"; } else { - $body = $xml->saveXml($xml->documentElement) . {$nl}; + $body = $xml->saveXml($xml->documentElement) . $nl; } if ($arguments['document'] === true) { $footer = "\n"; } } else { - $body = $xml->saveXml($xml->documentElement) . {$nl}; + $body = $xml->saveXml($xml->documentElement) . $nl; } // Indent body... @@ -358,7 +358,7 @@ private function runXhtml(XmlDocument $doc, XhtmlRenderingEngine $renderer): str $footer .= "\n"; } - $body = $xml->saveXml($xml->documentElement) . {$nl}; + $body = $xml->saveXml($xml->documentElement) . $nl; // Indent body... $indentBody = ''; From 37e44c3ff2782acfde28801c4423a2beb926677a Mon Sep 17 00:00:00 2001 From: bugalot Date: Fri, 22 Nov 2024 13:44:33 +0100 Subject: [PATCH 3/5] fix: enable usage of relative paths in CLI render command. --- src/qtism/cli/Render.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qtism/cli/Render.php b/src/qtism/cli/Render.php index 983d020e5..ec5f7b479 100644 --- a/src/qtism/cli/Render.php +++ b/src/qtism/cli/Render.php @@ -170,7 +170,7 @@ protected function run(): void $validate = !($arguments['novalidate'] === true); try { - $doc->load($source, $validate); + $doc->load(realpath($source), $validate); $renderingData = ''; From acec446267db08e6b40dda0d95d3ab2f1521cfe9 Mon Sep 17 00:00:00 2001 From: bugalot Date: Fri, 22 Nov 2024 14:27:36 +0100 Subject: [PATCH 4/5] fix: do not force php 8.4 because of a dependency. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 29b813e7c..856d19f68 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "league/flysystem": "^1.0|2.1.1|^3.0", "league/mime-type-detection": "^1.0", "oat-sa/lib-beeme": "0.2.0", - "wp-cli/php-cli-tools": "0.12.1" + "wp-cli/php-cli-tools": "0.11.22" }, "require-dev": { "phpunit/phpunit": "~9|~7", From bb879f94c330ca6ae910124d781e08cdb4faef53 Mon Sep 17 00:00:00 2001 From: bugalot Date: Thu, 12 Dec 2024 15:22:29 +0100 Subject: [PATCH 5/5] refactor: proper way to use filesystem in Render command. --- src/qtism/cli/Render.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qtism/cli/Render.php b/src/qtism/cli/Render.php index ec5f7b479..23bd9a925 100644 --- a/src/qtism/cli/Render.php +++ b/src/qtism/cli/Render.php @@ -33,6 +33,7 @@ use qtism\runtime\rendering\markup\goldilocks\GoldilocksRenderingEngine; use qtism\runtime\rendering\markup\xhtml\XhtmlRenderingEngine; use qtism\runtime\rendering\RenderingException; +use qtism\data\storage\xml\filesystem\FilesystemFactory; /** * Render CLI Module. @@ -167,10 +168,11 @@ protected function run(): void // Load XML Document. $source = $arguments['source']; $doc = new XmlDocument(); + $doc->setFileSystem(FilesystemFactory::local(getcwd())); $validate = !($arguments['novalidate'] === true); try { - $doc->load(realpath($source), $validate); + $doc->load($source, $validate); $renderingData = '';