fix: define ILIAS_HTTP_PATH for cron-triggered assignments#5
Open
thomas-neumann-axtesys wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Fatal
Undefined constant ILIAS_HTTP_PATHwhen plugin is triggered from cronSummary
UserSetting::doAssignements()fatals withError: Undefined constant "ILIAS\Repository\Form\ILIAS_HTTP_PATH"when the plugin is reached via cron authentication. The portfolio-related
side effects (and other GUI-coupled service constructions) transitively
require
ILIAS_HTTP_PATH, but ILIAS does not define that constant in CLIcontext until
ilCronManagerImpl::run()— which happens afterilCronStartUp::authenticate(), where the event chain that lands in thisplugin originates.
This PR defines
ILIAS_HTTP_PATHfromilias.ini.php([server] http_path)at the top of
doAssignements()when it is not already defined, using thesame helper ILIAS itself uses in
ilCronManagerImpl::run(). The guard is ano-op in HTTP context.
Reproduction
on_update = trueand aportfolio_nameset.
profile_incomplete = 1(a required corefield or UDF is empty), or
login_attempts > 0on ILIAS ≥ 9.2 — bothconditions cause
ilAuthFrontend::handleAuthenticationSuccessto call$user->update()and fire theServices/Object updateevent.php cli/cron.php run-jobs <cron_user> <client_id>.Result on ILIAS ≥ 9.0: fatal before any cron job runs.
Stack trace (abridged)
Root cause
ILIAS_HTTP_PATHis normally defined by:ilInitialisation::buildHTTPPath().ilCronManagerImpl::run():[server] http_pathfromilias.ini.php.RunActiveJobsCommandcalls$cron->authenticate()before the managerloop, so the constant is still undefined when the auth-success event fires
and lands in this plugin. From
doAssignements(), any branch that ends upconstructing portfolio access / GUI services (most directly
removePortfolio()via
ilPortfolioAccessHandler, but the same root cause applies to otherbranches that touch GUI-coupled services) hits
FormAdapterGUI::getOnLoadCode()and dereferences the missing constant.The chain has been reachable since ILIAS 9.0 (when
FormAdapterGUI::getOnLoadCode()started referencingILIAS_HTTP_PATH), buttypically only becomes fatal in cron once the cron user falls into one of
the
$user->update()branches inilAuthFrontend::handleAuthenticationSuccess— most commonly because the cron user has
profile_incomplete = 1.Fix
src/UserSetting/UserSetting.phpAdd
use ilUtil;and guard the entry todoAssignements():ilUtil::_getHttpPath()returns the value of[server] http_pathfromilias.ini.phpin CLI context — the same source ILIAS uses inilCronManagerImpl::run(). No new configuration is required beyond what cronalready needs.
Prerequisite
[server] http_pathmust be set in the globalilias.ini.php. This isalready an ILIAS requirement for cron in general —
ilCronManagerImpl::run()relies on the same value.