fix(transport): Re-download missing packages when zip or extracted folder is absent#16905
Open
Ibochkarev wants to merge 1 commit intomodxcms:3.xfrom
Open
fix(transport): Re-download missing packages when zip or extracted folder is absent#16905Ibochkarev wants to merge 1 commit intomodxcms:3.xfrom
Ibochkarev wants to merge 1 commit intomodxcms:3.xfrom
Conversation
…lder is absent - Add re-download logic: when zip is missing, use metadata location (or file.children.location) to fetch the package from provider - Treat empty unpacked directory as packed so package is re-unpacked - Add HTTP status check for cURL: do not save 4xx/5xx responses as zip - Add getMetadata() method to convert metadata into keyed array - Use url_scheme option for Referer in fsockopen (instead of hardcoded http://) - Skip re-download when sourceFile already contains URL (update mode) - Add guard when metadata has no usable location (early return with log) - Fix fsockopen: parse status line, return empty on 4xx/5xx, add SERVER_PROTOCOL fallback for CLI, use buffer size 32 for status line Refs modxcms#14018
8502f7f to
71d7fc3
Compare
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.
What does it do?
location(orfile.children.location) to get the download URL and fetch the package from the provider.url_schemeoption instead of hardcodedhttp://in fsockopen requests.$sourceFilealready contains a URL (//).$_SERVER[SERVER_PROTOCOL]fallback for CLI.Why is it needed?
The Package Manager could not re-download packages when the zip file or extracted folder was missing (e.g. after excluding the packages folder from backups). Re-install would fail without attempting a new download. Additionally, when the provider returned 4xx/5xx (e.g. 404 for removed packages), the error response was saved as a .zip file, causing "could not unpack package" failures.
How to test
core/packages/(or remove the unpacked folder).Related issue(s)/PR(s)
Ports logic from PR #14018 (Re-Download missing packages by exside). Addresses review feedback from comment #3963868915.