Repository navigation
Conversation
Based on the work of Daniel Weise (daniwe4) in ILIAS-eLearning#7897.
chfsx
force-pushed
the
improvement/12/setup-status-filter
branch
from
October 27, 2026 20:09
eabcf4e to
2dee6f0
Compare
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.
This picks up the idea of #7897 by @daniwe4:
php cli/setup.php statusgets a-foption to onlyshow a part of the status. While rebasing #7897 onto trunk I measured where the command actually
spends its time, and that led to a different implementation, so this is a new PR instead of an
update of the old one.
Where the time goes
Measured on a fresh trunk installation with 16 plugins, best of five runs:
statusstatus --no-legacy-pluginsstatus -f databasestatus -f config.commonStarting the CLI alone takes about 0.05 s, collecting the metrics of all core agents about 0.06 s.
Most of the rest was spent looking up the agents of the plugins: for every plugin the finder went
through all ~20 000 classes of the composer classmap, and before that walked recursively through
every file below
Customizing/global/plugins, including the vendor directories of the plugins.What changes
Find the agents of all plugins in one pass (
ImplementationOfAgentFinder)glob()instead of a recursive walk.status,update,achieve,migrate), and the gain grows with the number of plugins.getPluginAgent()no longer picks up classes of another plugin that happens to contain adirectory with the requested name.
Filter the status command by the path of a metric (
StatusCommand)status -f database.versiononly outputs that metric,status -f config.commonthe commonpart of the configuration section.
agent of the core, the agents of the plugins are not looked up at all, so a filtered call is
about as fast as starting the CLI.
agent, the message names the keys that are available at that point.
Differences to #7897
#7897 made the values of metrics lazy:
Metricand everyStorage::store*()method took acallable instead of a value, and stability and type became enums. With the agent selected by the
filter, that saves at most a few milliseconds, but it would break every plugin that reports a
status. This PR leaves the metrics API untouched, so plugins are not affected.
While rebasing #7897 I also found that its
storeStable*()andstoreVolatile*()methods storedeverything as config metrics, and its tests compared metrics including their closures, which never
checked the values. Neither applies here anymore.
Tests
ImplementationOfAgentFinderTest: plugins are found four levels below the plugin directory,agent classes of all plugins are searched in one pass, classes of other plugins are ignored.
StatusCommandTest: a filter for a core agent neither loads the plugins nor asks other agents,filters for plugins and for the configuration section, and the error cases.
AgentCollectionTest:withOnlyAgent().The complete output of
statuswithout a filter is unchanged.Thanks @daniwe4 for the proposal!