Skip to content

fix: resolve relative SystemUtility includes in installer AJAX endpoint - #845

Open
ocjorge wants to merge 1 commit into
opencats:masterfrom
ocjorge:fix/installer-relative-system-utility-includes
Open

fix: resolve relative SystemUtility includes in installer AJAX endpoint#845
ocjorge wants to merge 1 commit into
opencats:masterfrom
ocjorge:fix/installer-relative-system-utility-includes

Conversation

@ocjorge

@ocjorge ocjorge commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Problem

The resumeParsing case in modules/install/ajax/ui.php contained
four repeated relative include_once('lib/SystemUtility.php') calls
inside individual else blocks. Relative includes can fail when the
endpoint is accessed directly from a different working directory.

Solution

Replace the four repeated relative includes with a single
include_once(LEGACY_ROOT . '/lib/SystemUtility.php') at the top of
the resumeParsing case, before the conditional blocks.

This also removes the redundancy — include_once only loads the file
once anyway, so four calls in separate branches were unnecessary.

Context

This was noted as a pre-existing issue in PR #797:

"modules/install/ajax/ui.php still contains some pre-existing
relative includes such as include_once('lib/SystemUtility.php')
in the resume parsing path. Those lines were already present before
this branch and were not introduced by this commit. Since they are
a separate legacy relative-path issue rather than part of the
bootstrap-order change, I would prefer to handle them in a follow-up PR."

Replace four repeated relative include_once('lib/SystemUtility.php')
calls inside individual else blocks with a single include_once using
LEGACY_ROOT at the top of the resumeParsing case.

Relative includes can fail when the endpoint is accessed directly from
a different working directory. This was noted as a pre-existing issue
in PR opencats#797.
Copilot AI lite review requested due to automatic review settings August 29, 2026 04:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is narrowly scoped, consistent with existing LEGACY_ROOT include usage in the same file, and removes a confirmed source of brittle relative includes without altering behavior.

Pull request overview

This PR fixes a legacy relative-include problem in the installer’s resumeParsing AJAX action by switching SystemUtility loading to a LEGACY_ROOT-anchored path, making the endpoint resilient when executed from different working directories.

Changes:

  • Added a single include_once(LEGACY_ROOT . '/lib/SystemUtility.php') at the start of the resumeParsing case.
  • Removed four redundant relative include_once('lib/SystemUtility.php') calls from individual branches within resumeParsing.
File summaries
File Description
modules/install/ajax/ui.php Replaces repeated relative SystemUtility.php includes with one root-based include within resumeParsing to prevent direct-access include failures.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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