fix: resolve Phar updater strategies
This depends on https://github.com/laravel-zero/framework/pull/480 to be merged first. 👍🏻 See https://github.com/laravel-zero/framework/commit/477b05c7a90e85160c3b70985e4a695f24646402 for the actual changes.
What does this do:
- Adds a new
updater.phar_nameconfig key, that, when set, will be used to set the name of the Phar file as stored on GitHub, GitLab, etc. - Cleans up the
Updater/Provider
This solution appears to work for resolving the mentioned issue, however it could probably do with some testing elsewhere to ensure it doesn't break any existing applications.
Closes https://github.com/laravel-zero/laravel-zero/issues/459
@owenvoke you need to rebase.
@nunomaduro, done. 👍🏻 I have only tested these changes on the repo in the issue, so not sure if we want to do some further testing. 🤷🏻
Any news about this? What is preventing the merge?
@sergix44, I think it was just needing further testing (on real-world projects). If you have a project, feel free to test this branch. 🙂
If you have a project, feel free to test this branch. 🙂
Testing this branch now (https://github.com/hydephp/cli/pull/55/commits/4e2817a6219dd4473e7952b022eeaad3bf03d672), but I'm erroring on this version.
It tries to download https://github.com/hydephp/cli/raw/v0.5.2/hyde/builds/hyde instead of https://github.com/hydephp/cli/raw/v0.5.2/builds/hyde
Checking for a new version...
=============================
In Updater.php line 338:
file_get_contents(https://github.com/hydephp/cli/raw/v0.5.2/hyde/builds/hyde): Failed to open stream: HTTP request
failed! HTTP/1.1 404 Not Found
Edit: I can at least confirm that this branch makes so I don't get the following error:
PHP Fatal error: Uncaught ErrorException: include(): zlib: data error in phar://C:/Users/Caen/AppData/Roaming/Composer/vendor/hyde/cli/builds/hyde/.box/vendor/composer/ClassLoader.php:576
Stack trace:
[...]
PHP Fatal error: Uncaught ErrorException: include(phar://C:/Users/Caen/AppData/Roaming/Composer/vendor/hyde/cli/builds/hyde/vendor/composer/../symfony/error-handler/Error/FatalError.php): Failed to open stream: phar error: internal corruption of phar "C:/Users/Caen/AppData/Roaming/Composer/vendor/hyde/cli/builds/hyde" (actual filesize mismatch on file "vendor/symfony/error-handler/Error/FatalError.php") in phar://C:/Users/Caen/AppData/Roaming/Composer/vendor/hyde/cli/builds/hyde/.box/vendor/composer/ClassLoader.php:576
So this should at least fix https://github.com/laravel-zero/laravel-zero/issues/193#issuecomment-1853566528
If you have a project, feel free to test this branch. 🙂
Testing this branch now (hydephp/cli@4e2817a), but I'm erroring on this version.
It tries to download https://github.com/hydephp/cli/raw/v0.5.2/hyde/builds/hyde instead of https://github.com/hydephp/cli/raw/v0.5.2/builds/hyde
Checking for a new version... ============================= In Updater.php line 338: file_get_contents(https://github.com/hydephp/cli/raw/v0.5.2/hyde/builds/hyde): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
Mine is also a real world project, so 🤷 I dont know how many real world projects are needed before merging this fix, but in the mean time I fixed it like this: Extend the original update strategy and sent the current phar name: https://github.com/sergix44/hestiacp-companion/commit/f8167e7f6ae3d55e6167a3c3afc30f6905f16d62#diff-d033b3b431c042b24fe0c80c6deed53bf9eb3b69996a6348f57de3a6ed2ae490
And then set it as the update strategy: config/updater.php
Now the self update from the github releases should work as expected
@owenvoke
Okay so I've done some more testing, after changing the Composer include to use a base path (see review comment) it seems like this works, in that the release is downloaded.
I still get a Phar corruption error during the installation
But what is weird is that the downloaded binary works when I run it, so something must be wrong when verifying the download?