From 9e44e568a5af752407eaf2f25334d0f8a35bb752 Mon Sep 17 00:00:00 2001 From: Thomas Neumann Date: Wed, 13 May 2026 09:19:42 +0000 Subject: [PATCH] fix: define ILIAS_HTTP_PATH for cron-triggered assignments Mirror ilCronManagerImpl::run()'s defined()/define() fallback at the top of doAssignements(). The plugin is reached during cron auth, before the core fallback runs, while still pulling in GUI services that require the constant. --- src/UserSetting/UserSetting.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/UserSetting/UserSetting.php b/src/UserSetting/UserSetting.php index 903b9ae..29eb92f 100644 --- a/src/UserSetting/UserSetting.php +++ b/src/UserSetting/UserSetting.php @@ -24,6 +24,7 @@ use ilPortfolioAccessHandler; use ilPortfolioTemplatePage; use ilUserDefaultsPlugin; +use ilUtil; use php4DOMDocument; use srag\Plugins\UserDefaults\UDFCheck\UDFCheck; use srag\Plugins\UserDefaults\Utils\UserDefaultsTrait; @@ -167,6 +168,15 @@ public function create(): void public function doAssignements(ilObjUser $user): void { + // ILIAS_HTTP_PATH is normally set by the HTTP bootstrap, and in CLI cron by + // ilCronManagerImpl::run(). The plugin can however be reached earlier in the + // cron flow (via ilCronStartUp::authenticate() -> $user->update()), before + // that define has happened, while still pulling in GUI services that require + // it. Mirror the core fallback here so any branch of doAssignements is safe. + if (!defined('ILIAS_HTTP_PATH')) { + define('ILIAS_HTTP_PATH', ilUtil::_getHttpPath()); + } + $this->setUsrObject($user); if ($this->isValid()) { $this->generatePortfolio();