Skip to content

Refactored load.php into different use case startup parts#1853

Merged
s3inlc merged 6 commits intodevfrom
migration-setup-separation
Jan 14, 2026
Merged

Refactored load.php into different use case startup parts#1853
s3inlc merged 6 commits intodevfrom
migration-setup-separation

Conversation

@s3inlc
Copy link
Member

@s3inlc s3inlc commented Jan 13, 2026

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:

  • setup.php (only called once on start of the docker container) checking the migrations and initial setup (if needed)
  • include.php doing the part of including all needed files
  • load.php doing the UI startup initialization needed for the current UI, but is not required for the new API (and later can then be removed when the UI gets removed)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.php for 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.

@s3inlc s3inlc requested a review from jessevz January 13, 2026 13:17
@s3inlc s3inlc merged commit 831d43d into dev Jan 14, 2026
3 checks passed
@s3inlc s3inlc deleted the migration-setup-separation branch January 14, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants