Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #15190 - Improvements to upgrade.php script to improve Windows experience #15359

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

uberbrady
Copy link
Collaborator

This is not a complete fix for all of the problems listed in that issue, but it should handle several of the use-cases.

  1. When fetching the version requirements JSON blob, we now try to use file_get_contents() first, which can provide a better experience on Windows. But if allow_url_fopen is disabled, we fall back to using curl. This curl command might not work in Windows environments unless a CA bundle has been installed, typically this is done by installing OpenSSL.
  2. We check to see if the appropriate constants are defined before we try to set those options in curl. Only some versions of curl on Windows, for some versions of PHP, will have these constants pre-defined.
  3. We try to return valid, minimal JSON ({}) if all of the version requirements JSON-fetching fails, so the JSON parsing will still work - especially useful if you're using --skip-php-compatibility-checks.
  4. Some spurious output might have occurred when parsing the .env file; this fixes that.

We discussed the possibility of moving the backup part after the composer install part, but that's not going to make a difference - we also run php artisan down which would also fail if the current install is not properly composer install'ed. So I left it as-is. I'm OK with the idea of either making these failures less 'hard' or possibly introducing new command-line options to better handle a semi-donked Snipe-IT install. But I suspect we should do that in a separate PR.

@uberbrady uberbrady requested a review from snipe as a code owner August 21, 2024 11:05
Copy link

what-the-diff bot commented Aug 21, 2024

PR Summary

  • Improved Error Handling
    We have implemented new error handling measures to better ensure the stability and reliability of the application. This includes handling failures in retrieving remote requirements and dealing with issues related to malformed .env files.

  • Built Backup Mechanism for File Retrieval
    To fortify the resilience of our application, a backup mechanism has been added. If the primary method (file_get_contents) fails to retrieve a certain file, the system will automatically use curl as a fallback.

@snipe snipe merged commit 01c4fe6 into snipe:develop Aug 21, 2024
9 checks passed
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