Refactored load.php into different use case startup parts#1853
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the monolithic load.php file into three separate files with distinct responsibilities to improve performance by avoiding unnecessary database migrations on every page request. The new structure includes:
setup.php(one-time initialization with migrations)include.php(file includes only)load.php(UI-specific initialization)
Changes:
- Split initialization logic into three specialized files in
src/inc/startup/directory - Updated all UI page files to use
startup/load.php - Updated all API endpoint files to use
startup/include.php(avoiding UI overhead) - Updated docker entrypoint to call
startup/setup.phpfor one-time initialization
Reviewed changes
Copilot reviewed 57 out of 57 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/inc/startup/setup.php | Handles database migrations and initial setup (one-time execution) |
| src/inc/startup/include.php | Contains all file includes without UI or migration logic |
| src/inc/startup/load.php | Handles UI initialization, calls include.php internally |
| src/*.php (UI files) | Updated to require startup/load.php for full UI initialization |
| src/api/*.php | Updated to require startup/include.php for lightweight API execution |
| src/inc/apiv2/**/*.php | Updated to require startup/include.php for API v2 endpoints |
| src/install/**/*.php | Updated update scripts to use startup/load.php |
| docker-entrypoint.sh | Updated to call startup/setup.php for container initialization |
| ci/server/setup.php | Updated paths but contains critical bug (wrong directory name) |
| src/inc/apiv2/common/AbstractModelAPI.class.php | Added else clause to fix potential undefined variable (unrelated fix) |
Comments suppressed due to low confidence (1)
src/inc/startup/setup.php:5
- The documentation comment is missing an asterisk on line 4 to properly format as a multi-line comment. It should be " * This file should only..." instead of just "This file should only..."
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jessevz
approved these changes
Jan 14, 2026
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.
Currently, load.php is called on every page call. In there, migrations is executed every time causing additional database connections and unnecessary load.
This PR splits the load.php into three parts: