feat: detect and gate pending install migrations#803
Open
anonymoususer72041 wants to merge 5 commits into
Open
feat: detect and gate pending install migrations#803anonymoususer72041 wants to merge 5 commits into
anonymoususer72041 wants to merge 5 commits into
Conversation
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
This PR adds automatic detection for pending install schema migrations and prevents OpenCATS from continuing normal operation while those migrations still need to be finalized.
It introduces a central read-only migration status check for the install schema, blocks normal module schema processing from silently applying or finalizing install migrations during regular requests and shows a maintenance message for the Careers Portal while install migrations are pending.
For authenticated users, pending migrations are now handled through an application-level gate. Site administrators are shown a warning with an action that opens the install module maintenance flow through the normal OpenCATS front controller. Recruiters and other non-admin users are shown a message telling them to contact their administrator.
The actual migration execution remains handled by the existing
install:maintAJAX maintenance flow. Fresh installations withoutINSTALL_BLOCKremain compatible with the existing installer behavior, while installed systems require an authenticated site administrator and a CSRF token before maintenance can run.The integration test setup now finalizes the install schema version dynamically from
modules/install/Schema.php, so CI test databases represent an already finalized installed snapshot without hard-coding the current install schema version indb/cats_schema.sql.Motivation
Previously, pending install schema migrations could be difficult to notice during normal application usage. This could allow users to continue using OpenCATS while the database schema was not fully aligned with the application code and the Careers Portal could remain publicly available during that state.
Detecting pending migrations centrally makes this state explicit and safer. Blocking the Careers Portal avoids exposing applicants to an application that still requires maintenance, while gating authenticated application requests prevents existing sessions or direct module URLs from bypassing the warning.
Using the existing install module and
install:maintmaintenance flow keeps the implementation close to current OpenCATS behavior and avoids introducing a second migration execution path.