From 80f348a4d24a0c72a223e383c9357e14b3793bf3 Mon Sep 17 00:00:00 2001 From: Christian Knof Date: Thu, 5 Nov 2026 12:00:57 +0100 Subject: [PATCH] [FIX] Language: 48669: Install plugins with cli/setup.php `ilLanguage` uses the `NullLogger` when `ilLoggerFactory` or `logging.factory` is not defined in `$DIC`, as in the setup objectives that build their own `$DIC`. The fake `ilLoggerFactory` in `ilPluginLanguageUpdatedObjective` drops the dead `getRootLogger()` override. Its fake `ilObjUser` returns the language via `getLanguage()`, as `ilObjUser` no longer has `$prefs`. --- .../Setup/class.ilPluginLanguageUpdatedObjective.php | 10 +++++----- components/ILIAS/Language/classes/class.ilLanguage.php | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/ILIAS/Language/classes/Setup/class.ilPluginLanguageUpdatedObjective.php b/components/ILIAS/Language/classes/Setup/class.ilPluginLanguageUpdatedObjective.php index 2b6c4c93ba95..eed74f1bfdb0 100755 --- a/components/ILIAS/Language/classes/Setup/class.ilPluginLanguageUpdatedObjective.php +++ b/components/ILIAS/Language/classes/Setup/class.ilPluginLanguageUpdatedObjective.php @@ -142,10 +142,6 @@ protected function initEnvironment(Setup\Environment $environment, \ilComponentR public function __construct() { } - public static function getRootLogger(): ilLogger - { - return $GLOBALS["DIC"]["ilLog"]; - } public static function getLogger(string $a_component_id): ilLogger { return $GLOBALS["DIC"]["ilLog"]; @@ -188,7 +184,11 @@ public function __construct() $GLOBALS["DIC"]["ilUser"] = new class () extends ilObjUser { public function __construct() { - $this->prefs["language"] = "en"; + } + + public function getLanguage(): string + { + return 'en'; } }; diff --git a/components/ILIAS/Language/classes/class.ilLanguage.php b/components/ILIAS/Language/classes/class.ilLanguage.php index 5ddea200dd2e..6ad0ccb21a83 100755 --- a/components/ILIAS/Language/classes/class.ilLanguage.php +++ b/components/ILIAS/Language/classes/class.ilLanguage.php @@ -25,6 +25,7 @@ use ILIAS\Language\ComponentTranslation\TranslationGettextRepository; use ILIAS\Language\ComponentTranslation\TranslationRepository; use ILIAS\Language\LanguageIdentifier; +use ILIAS\components\Logging\NullLogger; /** * language handling @@ -112,7 +113,9 @@ public function __construct(string $a_lang_key, ?TranslationRepository $translat $this->translations = $translations; $client_ini = $DIC->clientIni(); - $this->log = $DIC->logger()->forComponent('lang'); + $this->log = isset($DIC['ilLoggerFactory'], $DIC['logging.factory']) + ? $DIC->logger()->forComponent('lang') + : new NullLogger(); $this->lang_key = $a_lang_key;