From 6d8763a22c93a4de4ac38ca82c1b816913003b18 Mon Sep 17 00:00:00 2001 From: Dave M Date: Tue, 14 Jul 2026 15:45:38 +0000 Subject: [PATCH] - Fixes made mostly for PHP 8.5 --- meta/definitions/software.php | 4 ++-- meta/i18n/fr/lean.debugging.json | 3 ++- src/Cli/Console.php | 4 ++-- src/Cli/Storage.php | 4 ++-- src/Controller/Debugging.php | 11 +++++------ src/Lib/ConsoleControllerTrait.php | 9 +-------- view/lean-console/page/debugging/logs.phtml | 3 ++- 7 files changed, 16 insertions(+), 22 deletions(-) diff --git a/meta/definitions/software.php b/meta/definitions/software.php index 6939785..bf39fe6 100644 --- a/meta/definitions/software.php +++ b/meta/definitions/software.php @@ -26,7 +26,7 @@ return [ 'ulmus' => [ 'entities' => [ - 'Lean\\Console\\Entity\\Firewall' => implode(DIRECTORY_SEPARATOR, [ $path , "src", "Entity", "Firewall" ]), + Lean\Console\Entity\Firewall::class => implode(DIRECTORY_SEPARATOR, [ $path , "src", "Entity", "Firewall" ]), ], ], @@ -44,7 +44,7 @@ return [ ], 'routes' => ! getenv('DEBUG') ? [] : [ - 'Lean\\Console\\Controller' => implode(DIRECTORY_SEPARATOR, [ $path, "src", "Controller", "" ]), + Lean\Console\Controller::class => implode(DIRECTORY_SEPARATOR, [ $path, "src", "Controller", "" ]), ], ], diff --git a/meta/i18n/fr/lean.debugging.json b/meta/i18n/fr/lean.debugging.json index 877d942..4af194c 100644 --- a/meta/i18n/fr/lean.debugging.json +++ b/meta/i18n/fr/lean.debugging.json @@ -2,7 +2,8 @@ "title" : "Debugging -- LEAN", "page-title": "Déboguage", "logs": { - "breadcrumb": "Journaux d'événements" + "breadcrumb": "Journaux d'événements", + "line": "Lines number: " }, "phpinfo": { "breadcrumb": "phpinfo()" diff --git a/src/Cli/Console.php b/src/Cli/Console.php index f501ab8..654fcb5 100644 --- a/src/Cli/Console.php +++ b/src/Cli/Console.php @@ -19,9 +19,9 @@ use Lean\Console\{Lib, }; #[color:gray, bg: black]║ ║[#] #[color:gray, bg: black]╚═════════════════════════╝[#] -Try #[color:gray, bg: black]'lean console --help'[#] for more information. +Try #[color:gray, bg: black]'cli lean-console --help'[#] for more information. CLI -, command: 'console')] +, command: 'lean-console')] #[Option(switch: ['-h', '--help'], description: "Display help for the given command. When no command is given display help for the list command")] #[Option(switch: ['-q', '--quiet'], description: "Do not output any message")] #[Option(switch: ['-n', '--no-interaction'], description: "Run script without user interaction")] diff --git a/src/Cli/Storage.php b/src/Cli/Storage.php index c15db05..96d83a5 100644 --- a/src/Cli/Storage.php +++ b/src/Cli/Storage.php @@ -20,9 +20,9 @@ use Lean\Console\{Lib, }; #[color:gray, bg: black]║ STORAGE ║[#] #[color:gray, bg: black]╚═════════════════════════╝[#] -Try #[color:gray, bg: black]'lean console storage --help'[#] for more information. +Try #[color:gray, bg: black]'cli lean-console storage --help'[#] for more information. CLI -, command: 'console storage')] +, command: 'lean-console storage')] #[Option(switch: ['-h', '--help'], description: "Display help for the given command. When no command is given display help for the list command")] #[Option(switch: ['-q', '--quiet'], description: "Do not output any message")] #[Option(switch: ['-n', '--no-interaction'], description: "Run script without user interaction")] diff --git a/src/Controller/Debugging.php b/src/Controller/Debugging.php index 0a0b294..5e38fa9 100644 --- a/src/Controller/Debugging.php +++ b/src/Controller/Debugging.php @@ -2,12 +2,11 @@ namespace Lean\Console\Controller; -use League\Route\Router; -use Picea\{FileFetcher, Picea, Caching\Opcache, Extension\UrlExtension, Ui\Method\FormHandler}; +use Picea\{Ui\Method\FormHandler}; use Lean\File; use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface }; use Lean\Console\{ Form, Lib }; -use Notes\Tell\Attribute\Language, Notes\Route\Attribute\Method\Route; +use Notes\Route\Attribute\Method\Route; class Debugging extends Console { use Lib\ConsoleControllerTrait; @@ -17,7 +16,7 @@ class Debugging extends Console { { $list = []; - new FormHandler($request, new Form\Debugging\Logs(), $this->pushContext(new Lib\FormContext($request, "debugging.logs"))); + # new FormHandler($request, new Form\Debugging\Logs(), $this->pushContext(new Lib\FormContext($request, "debugging.logs"))); $path = getenv('LOGS_PATH'); @@ -25,9 +24,9 @@ class Debugging extends Console { $default = basename(ini_get('error_log')); - $open = end($files); + $open = File::sanitizeFilePath($request->getQueryParams()['logfile'] ?? end($files)); - $content = File::tail($path . DIRECTORY_SEPARATOR . $open, 100); + $content = File::tail($path . DIRECTORY_SEPARATOR . $open, $request->getQueryParams()['line'] ?? 100); return $this->renderView("lean-console/page/debugging/logs", get_defined_vars()); } diff --git a/src/Lib/ConsoleControllerTrait.php b/src/Lib/ConsoleControllerTrait.php index 36a0a37..11630b8 100644 --- a/src/Lib/ConsoleControllerTrait.php +++ b/src/Lib/ConsoleControllerTrait.php @@ -24,18 +24,11 @@ trait ConsoleControllerTrait #[Inject] protected ContainerInterface $container; - #[Ignore] - public function __construct(? Picea\Picea $picea, Session $session, ContainerInterface $container) { - $this->picea = $picea; - $this->session = $session; - $this->container = $container; - } - #[Ignore] public function version() : string { $version = iterator_to_array( - (new Form\Update\Git(getenv('PROJECT_PATH')))->run("/usr/bin/git describe --tags") + new Form\Update\Git(getenv('PROJECT_PATH'))->run("/usr/bin/git describe --tags") ); # dump($version); diff --git a/view/lean-console/page/debugging/logs.phtml b/view/lean-console/page/debugging/logs.phtml index 5493db7..274128b 100644 --- a/view/lean-console/page/debugging/logs.phtml +++ b/view/lean-console/page/debugging/logs.phtml @@ -10,7 +10,8 @@

{{ $path }}

{% ui:form.get current_url() %} - {% ui:select 'logfile', array_combine($files, $files), get('file') ?? $open %} + {% _ 'logs.line' %} {% ui:text 'line', get('line') ?? 100, [ 'onchange' => "this.closest('form').submit()" ] %} + {% ui:select 'logfile', array_combine($files, $files), get('file') ?? $open, [ 'onchange' => "this.closest('form').submit()" ] %} {% ui:endform %}