refactor(installer): reduce deep nesting in installShippedApps()#57307
Open
joshtrichards wants to merge 2 commits intomasterfrom
Open
refactor(installer): reduce deep nesting in installShippedApps()#57307joshtrichards wants to merge 2 commits intomasterfrom
joshtrichards wants to merge 2 commits intomasterfrom
Conversation
Extracts nested directory scanning and app filtering logic into dedicated helper methods, reducing nesting from 5-6 levels to 2-3. Modernizes directory traversal to use scandir() instead of opendir/readdir/closedir pattern. No functional changes - preserves exact same behavior including error handling for TableExistsException during upgrades. Relates to #8505 (app management code consolidation) Signed-off-by: Josh <[email protected]>
Signed-off-by: Josh <[email protected]>
CarlSchwan
approved these changes
Jan 2, 2026
come-nc
reviewed
Jan 6, 2026
| * @param string $path Path to the app directory to scan | ||
| * @return string[] App IDs found | ||
| */ | ||
| private function scanAppsInDirectory(string $path): array { |
Contributor
There was a problem hiding this comment.
Ideally this shoud be a Generator?
Comment on lines
+555
to
+556
| && is_dir("$path/$entry") | ||
| && file_exists("$path/$entry/appinfo/info.xml") |
Contributor
There was a problem hiding this comment.
is the is_dir necessary? The file_exists should be enough I think.
| * @param string $appId The app ID to check | ||
| * @return bool True if app should be installed | ||
| */ | ||
| private function shouldInstallShippedApp(string $appId): bool { |
Contributor
There was a problem hiding this comment.
nitpick but I would prefer a test for each case returning early, it feels bad doing more getAppValue calls than necessary.
Merged
This was referenced Jan 29, 2026
Merged
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.
Summary
scandir()instead of opendir/readdir/closedir pattern.No functional changes - preserves exact same behavior including error handling for
TableExistsExceptionduring upgrades.Before:
TODO
Checklist
3. to review, feature component)stable32)