From f051064f6c6a0e4b23b152f026c32edad9b495c8 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 13 Oct 2025 14:35:42 +0400 Subject: [PATCH] maj nulib-base --- nur_bin/datectl.php | 2 +- nur_bin/dumpser.php | 2 - nur_src/b/authnz/AuthzManager.php | 1 - nur_src/b/io/FileCachedValue.php | 4 +- nur_src/cli/Application.php | 71 ++++++++----------- nur_src/ldap/LdapSearch.php | 2 +- nur_src/ldap/app/LdapDeleteApp.php | 2 +- nur_src/ldap/ldap_server.php | 2 +- nur_src/m/pdo/mysql/MysqlQuery.php | 2 +- nur_src/m/pgsql/PgsqlConn.php | 1 - nur_src/v/base/AbstractPageContainer.php | 1 - nur_src/v/bs3/vc/CTable.php | 3 - .../v/html5/Html5NavigablePageContainer.php | 1 - nur_src/v/html5/Html5VanillaPageContainer.php | 1 - nur_tbin/base/test-args4.php | 2 +- tbin/legacy-test-console.php | 2 +- tbin/legacy-test-levels.php | 2 +- tbin/legacy-test-nested-actions.php | 3 +- tests/php/coll/CursorTest.php | 6 -- tests/php/content/cTest.php | 1 - tests/schema/_assoc/AssocSchemaTest.php | 6 +- tests/schema/_scalar/ScalarSchemaTest.php | 2 +- tests/schema/_scalar/ScalarWrapperTest.php | 2 +- tests/schema/types/boolTest.php | 2 +- tests/schema/types/floatTest.php | 2 +- tests/schema/types/intTest.php | 2 +- tests/schema/types/strTest.php | 2 +- tests/schema/types/unionTest.php | 2 +- 28 files changed, 51 insertions(+), 80 deletions(-) diff --git a/nur_bin/datectl.php b/nur_bin/datectl.php index 3d46ddd..3f4a273 100755 --- a/nur_bin/datectl.php +++ b/nur_bin/datectl.php @@ -2,9 +2,9 @@ nmsg::DEBUG, - ])); + ]); + nsay::set_messenger($con); + nmsg::set_messenger($con); } protected static function _app_configure(Application $app): void { @@ -183,17 +188,20 @@ EOT); # initiale est faite msg::get()->setLevels(msg::PRINT_LEVELS, msg::LOG_LEVELS, msg::TYPE_LEVELS); - $msgs = ["console" => new StdMessenger([ - "min_level" => nmsg::NORMAL, - ])]; + $con = ncon::set_messenger(new ConsoleMessenger([ + "min_level" => ncon::NORMAL, + ])); + nsay::set_messenger($con, true); + nmsg::set_messenger($con, true); if (static::USE_LOGFILE) { - $msgs["log"] = new StdMessenger([ + $log = nlog::set_messenger(new LogMessenger([ "output" => app::get()->getLogfile(), "min_level" => nmsg::MINOR, - "add_date" => true, - ]); + ])); + } else { + $log = nlog::set_messenger(new ProxyMessenger()); } - nmsg::init($msgs); + nmsg::set_messenger($log); $app->parseArgs(); config::configure(); @@ -282,14 +290,15 @@ EOT); "action" => [null, "set_application_profile"], "help" => "spécifier le profil d'exécution", ], - ["-P", "--prod", "action" => [config::class, "set_profile", config::PROD]], - ["-T", "--test", "action" => [config::class, "set_profile", config::TEST]], - ["--devel", "action" => [config::class, "set_profile", config::DEVEL]], + ["-P", "--prod", "action" => [null, "set_application_profile", config::PROD]], + ["-T", "--test", "action" => [null, "set_application_profile", config::TEST]], + ["--devel", "action" => [null, "set_application_profile", config::DEVEL]], ], ]; static function set_application_profile(string $profile): void { config::set_profile($profile); + app::set_profile($profile); } const VERBOSITY_SECTION = [ @@ -322,7 +331,6 @@ EOT); static function set_application_verbosity(string $verbosity): void { $msg = msg::get(); - $nconsole = nconsole::get(); switch ($verbosity) { case "s": case "silent": @@ -331,9 +339,7 @@ EOT); msg::TECH => msg::NEVER, msg::EXCEPTION => msg::NEVER, ]); - $nconsole->resetParams([ - "min_level" => nmsg::NONE, - ]); + ncon::set_verbosity("silent"); break; case "Q": case "very-quiet": @@ -342,9 +348,7 @@ EOT); msg::TECH => msg::CRITICAL, msg::EXCEPTION => msg::NEVER, ]); - $nconsole->resetParams([ - "min_level" => nmsg::MAJOR, - ]); + ncon::set_verbosity("quiet"); break; case "q": case "quiet": @@ -353,9 +357,7 @@ EOT); msg::TECH => msg::MAJOR, msg::EXCEPTION => msg::NEVER, ]); - $nconsole->resetParams([ - "min_level" => nmsg::MAJOR, - ]); + ncon::set_verbosity("quiet"); break; case "v": case "verbose": @@ -364,9 +366,7 @@ EOT); msg::TECH => msg::MINOR, msg::EXCEPTION => msg::NEVER, ]); - $nconsole->resetParams([ - "min_level" => nmsg::MINOR, - ]); + ncon::set_verbosity("verbose"); break; case "D": case "debug": @@ -376,9 +376,7 @@ EOT); msg::TECH => msg::MINOR, msg::EXCEPTION => msg::NORMAL, ], null, msg::DEBUG); - $nconsole->resetParams([ - "min_level" => nmsg::DEBUG, - ]); + ncon::set_verbosity("debug"); break; case "T": case "trace": @@ -388,9 +386,7 @@ EOT); msg::TECH => msg::MINOR, msg::EXCEPTION => msg::MINOR, ], null, msg::DEBUG); - $nconsole->resetParams([ - "min_level" => nmsg::DEBUG, - ]); + ncon::set_verbosity("debug"); break; default: throw ValueException::invalid_value($verbosity, "verbosity"); @@ -403,18 +399,13 @@ EOT); static function set_application_log_output(string $logfile): void { msg::get()->setParametrableParams(["log_output" => $logfile]); - nlog::create_or_reset_params([ + nlog::reset_params([ "output" => $logfile, - ], StdMessenger::class, [ - "add_date" => true, - "min_level" => nlog::MINOR, ]); } static function set_application_color(bool $color): void { msg::get()->setParametrableParams(["color" => $color]); - nconsole::reset_params([ - "color" => $color, - ]); + ncon::set_color($color); } const ARGS = [ "sections" => [ diff --git a/nur_src/ldap/LdapSearch.php b/nur_src/ldap/LdapSearch.php index 41efaf9..b7c3820 100644 --- a/nur_src/ldap/LdapSearch.php +++ b/nur_src/ldap/LdapSearch.php @@ -2,6 +2,7 @@ namespace nur\ldap; use IteratorAggregate; +use nulib\output\msg; use nur\A; use nur\b\params\Parametrable; use nur\b\params\Tparametrable; @@ -10,7 +11,6 @@ use nur\b\ValueException; use nur\data\types\md_utils; use nur\data\types\Metadata; use nur\iter; -use nulib\output\msg; class LdapSearch extends Parametrable implements IteratorAggregate { use Tparametrable; diff --git a/nur_src/ldap/app/LdapDeleteApp.php b/nur_src/ldap/app/LdapDeleteApp.php index 5c73d26..e69c861 100644 --- a/nur_src/ldap/app/LdapDeleteApp.php +++ b/nur_src/ldap/app/LdapDeleteApp.php @@ -1,9 +1,9 @@