[5.4] Implement autoupdate plugin events#45696
Conversation
Co-authored-by: Brian Teeman <brian@teeman.net>
Co-authored-by: Brian Teeman <brian@teeman.net>
|
I clearly see the use case for this. But might it not be against the whole idea of automated updates when a plugin can stop it. I see this problematic when a high security release is shipped and a plugin blocks the update. Leaves a site vulnerable for an amount of time. Not saying this is a bad idea, but needs probably also some way to ignore it in emergency cases. |
Allowing users to disable automated updates is also aginst the whole idea ;) At the end of the day, we can only offer the service as an option, it's up to the users to decide if and how they use it. |
|
In my opinion the feature should be fully transparent. Because for example when I enable autoupdate, and it suddenly stop working because some extension decided to stop it, what should I do, how I find a reason? I will go to Joomla and complain "your stuff is broken". |
So, how would that work with the mentioned example of a backup extension enforcing a backup created within the last x hours? It's a pretty obvious usecase. Should that extension disable the respective parameter in the config of com_joomlaupdate? |
|
I think some kind of lock file, method that is often used for avoiding such conflicts. Probably 2: |
|
But we would need a lockfile per extension to avoid locks of extension A being cleared by extension B, so that quickly becomes complex. It would also require extensions to do periodic checks if the update conditions are still met to write that lockfile upfront, leading to potential race-condition-like situations where an update could be installed now, but the extension has not cleared the lock yet. I'm not necessarily against it, just trying to weight effort (for initial implementation and maintenance) against the extra benefit. |
Hm, why? we just need one, for common agreement the backup extension will use the one. it could hold timestamp, and extension name when needed, but could work just empty. upd: I mean, internally each backup extension could use anything, own lock file etc. But for Joomla they have to provide the lock file that we agree. |
|
hm, but if the following message is logged somewhere Then use the event is probably fine |
You mean logfile-like logging? Or something that's UI-accessible? |
Log file. |
@ChristineWk Did you install
After installation of the plugin, you can try Joomla check for (manual) update and version 5.4.110 will be offered. Do not install manually! Enable automated updates and within 24 hours the update should be done and you will receive an email like I did last night. Good luck |
|
@muhme Thank you for your information!
|
|
@ChristineWk I assume it's a publicly available site, not a local instance, correct? |
Yes (sorry) it's a public test-site. |
It is visible if you go to System > Plugins > System - Alpha Update Server
No, this is the manual Joomla update. You have to wait 24 hours for automated update happens. Once the Automated Update was successul, then you have verified Automated Update is working without this PR. Next step is to install again fresh, this time from full package build (see All checks passed > Download > Joomla_5.4.0-alpha3-dev+pr.45696-Development-Full_Package.zip or having standard 5.4-dev installation and install Patch Tester and Apply Patch 45696. Then you install and enable the demo plugin plg_autoupdatepreventer.zip. No automatic update should take place within the next 24 hours. You can also test that with this PR and without plg_autoupdatepreventer the Automated Update is still working. |
|
@ChristineWk your webhost is blocking incoming connections from the update server |
|
Another attempt to test: Installed from Joomla_5.4.0-alpha4-dev+pr.45696-Development-Full_Package.zip two times joomla-test.heikol.de and joomla-test2.heikol.de
Results after > 24 hours
|
As mentioned before: Expected behavior: your test sites are currently registered twice in the update server, with both the old and the new update token; the update server will re-try "unconnected" sites with the old token for a grace period and then remove them if the connection can not be restored
Unrelated from this PR.
Added to the log file
The frontend has an error message, please double check: https://joomla-test2.heikol.de/ - for the same reason no information message could be sent to you, the site returned an exception |
|
Thank you @SniperSister and my summary after our discussion:
|
Hi @SniperSister, I have just tested this and I have this in my joomla_update.php, is that a successful test in your mind? (just unsure if that is what I am supposed to get) #Fields: datetime priority clientip category message |
|
@exlemor looks good to me! I assume you also received notification mails? |
|
I have tested this item ✅ successfully on 63998ca This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45696. |
yes :) |
|
I have tested this item ✅ successfully on 012d44f
Observations
|
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45696. |
|
Thanks all (author, reviewers and testers). |



Summary of Changes
This PR adds a new plugin event that allows 3rd party extensions to stop automatted updates. This allows 3rd party developers to i.e. enforce special conditions like "only perform auto updates if a backup using my backup extension has been performed in the last 24h".
Furthermore, this PR also fixed the version number in the "failed update" notfication that is sent when an update is blocked by a plugin.
Side note: A new "after update" event is not required, as the default after update event will be called.
Testing Instructions
Actual result BEFORE applying this Pull Request / or after disabling the plugin
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