-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[6.1] Improvements to extension updater #46054
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
base: 6.1-dev
Are you sure you want to change the base?
Conversation
Avoid PHP warning on missing target platform information. For instance: https://raw.githubusercontent.com/trananhmanh89/ff-update-server/master/com_ffexplorer.xml
This reverts commit d7e5e1e.
administrator/components/com_installer/src/Model/UpdateModel.php
Outdated
Show resolved
Hide resolved
administrator/components/com_installer/src/Model/UpdateModel.php
Outdated
Show resolved
Hide resolved
libraries/src/Event/Installer/AfterPackageDownloadFailedEvent.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Brian Teeman <[email protected]>
Co-authored-by: Brian Teeman <[email protected]>
Co-authored-by: Brian Teeman <[email protected]>
Add support for dynamic URL generation with Joomla and PHP versions.
|
Why is PHPstan failing? See lines 91 and 131 in InstallerHelper.php |
|
@BrainforgeUK PHPstan fails because you added another call to the deprecated getDispatcher, so the count for the exclusion in the You can fix that by running |
|
P.S.: If you don't have a development environment so you can't do what I recommended in my previous comment, then let me know here and I will do it later. |
** Yes please, can you do that for me. Thanks. |
** Yes please, can you do that for me. Thanks. !! Help have the same issue with #46413 !! |
|
@BrainforgeUK I have checked the PHPstan error message. You can do that, too, by checking the changed files on GitHub. Maybe you should not use Joomla 3 code in your PRs? @HLeithner Could you maybe advise here what can be done instead of using the deprecated interface "Joomla\CMS\Application\EventAwareInterface"? |
I am not Harald, but it as i already wrote. Ignore it. DispatcherAwareInterface::getDispatcher()and EventAwareInterface::getDispatcher()The I think PHPStan cannot distinguish this race condition 😉 |
|
I see. Will update phpstan baseline tomorrow. |
|
I've updated the |
|
Changes in I think changes in As I understand the aim is to show to User the error. joomla-cms/libraries/src/Installer/InstallerHelper.php Lines 103 to 107 in 1c30e1b
Here we can show server message when it return 403, kind of: if (200 != $response->getStatusCode()) {
Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_DOWNLOAD_SERVER_CONNECT', $response->getStatusCode()), Log::WARNING, 'jerror');
if (403 === $response->getStatusCode()) {
$body = (string) $response->getBody();
// Show response message, but ignore default server error pages
if ($body && !str_contains($body, '</body>')) {
//Translate JLIB_INSTALLER_ERROR_DOWNLOAD_SERVER_MESSAGE="Error downloading the packge: %1$s. %2$s"
Log::add(Text::sprintf('JLIB_INSTALLER_ERROR_DOWNLOAD_SERVER_MESSAGE', $url, $body), Log::WARNING, 'jerror');
}
}
return false;
}Nothing special, if the key is wrong Developer just throw 403 on their server and show any text they want to show. AfterPackageDownloadFailedEvent This event does not really make sense on first look. If it also just to show message, then probably can be also unnecessary after changes in |
Add logging for 403 response status with custom message.
|
Added 403 handler as suggested. Kept JSON response handling and onInstallerAfterPackageDownload event. |
Pull Request for Issue # .
Summary of Changes
Added event handler response checks for:
Added events:
Testing Instructions
Install these extensions - no need to enable them.
plg_test_test1v1.zip
plg_test_test2v1.zip
Go to check for updates.
v2.0.0 of these will be available.
plg_test_test1
plg_test_test2
Update plg_test_test1
Works fine, updated to v2.0.0
Update plg_test_test2
Actual result BEFORE applying this Pull Request
Expected result AFTER applying this Pull Request
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
https://manual.joomla.org/docs/building-extensions/install-update/update-server/ will need to be updated along the following lines:
For instance the above test will return this (after PHP json_decode()):
array (
'message' => '<strong>plg_test_test2: </strong>The subscription key you provided is expired or invalid. Please purchase a new subscription key.',
'type' => 'info',
'success' => false,
'error' => true,
'downloadfailmessage' => '',
)
Here is an example of a generic installer plugin which provides similar functionality for update servers which don't provide a JSON response. It also attempts to detect an update site which returns a HTML document and not a ZIP!
plg_installer_generic.zip