fix: optimize dpkg calls and fix sed backreferences in php-update.sh - #232
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/EngineScript/EngineScript/sessions/73ed6009-28c1-4fe3-b00d-06f2d4a42251 Co-authored-by: PDowney <11467177+PDowney@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize dpkg command execution for PHP version check
fix: optimize dpkg calls and fix sed backreferences in php-update.sh
May 2, 2026
Removed outdated PHP update section from CHANGELOG.
PDowney
approved these changes
May 2, 2026
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves scripts/update/php-update.sh by reducing repeated package-manager calls during PHP version detection and by consolidating sed patterns used to migrate Nginx/PHP-related configuration references when upgrading PHP-FPM.
Changes:
- Cache
dpkg -loutput for old-version detection and usedpkg-queryfor an exact “already installed” check. - Introduce shared
SOCKET_EXPR/FASTCGI_EXPRsed templates used across Nginx config updates. - Fix sed backreference grouping for the admin control panel API update rule.
Comment on lines
+135
to
+136
| SOCKET_EXPR='s|(unix:/run/php/)php%s-fpm(\.sock)|\1php%s-fpm\2|g' | ||
| FASTCGI_EXPR='s|(fastcgi_pass[[:space:]]+[^;]*php)%s(-fpm)|\1%s\2|g' |
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.



Software Version Updates
Four correctness and performance fixes to
scripts/update/php-update.sh.Changed Versions
scripts/update/php-update.shdpkg -l: Capture output once intoDPKG_LIST_OUTPUTbefore the version-detection loop; grep against the variable instead of forking a newdpkg -lsubprocess per iteration.dpkg -l | grep -qwithdpkg-query -W -f='${Status}' ... | grep -q 'install ok installed'for an exact package-state match.SOCKET_EXPRandFASTCGI_EXPRas printf-style pattern templates used by bothphp-fpm.confand per-site nginx config updates, eliminating regex drift between the two update paths.\1referencing the wrong capture group. Restructured froms|php${OLD_VER}(-fpm)?|php${NEW_PHP_VER}\1|gtos|(php)${OLD_VER}(-fpm)?|\1${NEW_PHP_VER}\2|gso\1=phpand\2=(-fpm)?.Version Diff
Verification Checklist
Notes
This is an automated pull request created by the software version checker workflow.
Please verify these versions are stable releases before merging.
Original prompt