Skip to content

sitehost:phpconfig: patch ini lines in-place, create file/dir if missing#9

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/add-server-config-command
Draft

sitehost:phpconfig: patch ini lines in-place, create file/dir if missing#9
Copilot wants to merge 5 commits intomasterfrom
copilot/add-server-config-command

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 6, 2026

The original task truncated ps-custom.ini on every run, destroying any unmanaged directives already in the file. It also had no guarantee the file or its parent directory existed.

Changes

  • Patch in-place instead of overwriting — for each of the three managed keys (memory_limit, post_max_size, max_execution_time), uses grep+sed -i to update an existing line, or appends if absent
  • Create directory and file if missing — preflight mkdir -p … && touch ensures the path exists before patching, even on a fresh container
  • Safe value escapingstrtr() for atomic sed-metacharacter escaping (\, |, &) to avoid double-escaping; escapeshellarg() on the echo append path
run('mkdir -p ~/container/config/php/conf.d && touch ' . $ini);
// per key:
run("grep -q '^{$key}=' {$ini}"
    . " && sed -i 's|^{$key}=.*|{$key}={$sedValue}|' {$ini}"
    . " || echo {$key}={$shellValue} >> {$ini}");

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: brad-ps <107819630+brad-ps@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sitehost:prepare:serverconfig command for config settings Add sitehost:prepare:serverconfig task for per-host PHP INI config Mar 6, 2026
Copilot stopped work on behalf of brad-ps due to an error March 6, 2026 00:47
Co-authored-by: brad-ps <107819630+brad-ps@users.noreply.github.com>
Copilot AI changed the title Add sitehost:prepare:serverconfig task for per-host PHP INI config Rename sitehost:prepare:serverconfig to sitehost:phpconfig Mar 6, 2026
Copilot AI and others added 2 commits March 6, 2026 01:19
Co-authored-by: brad-ps <107819630+brad-ps@users.noreply.github.com>
Co-authored-by: brad-ps <107819630+brad-ps@users.noreply.github.com>
Copilot AI changed the title Rename sitehost:prepare:serverconfig to sitehost:phpconfig sitehost:phpconfig: patch ini lines in-place, create file/dir if missing Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants