User tests: Successful: Unsuccessful:
Update extension
and installer
plugins to use SubscriberInterface
event classes.
Test that extension installation works as before.
Joomla update also works as before.
Works
Works
Please select:
Enhancement
extension
and installer
plugins to use SubscriberInterface
event classes.AbstractJoomlaUpdateEvent
class and its concrete implementations BeforeJoomlaUpdateEvent
and AfterJoomlaUpdateEvent
.SubscriberInterface
for various extension plugins and updated their methods to use event classes.Relevant files | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Enhancement | 9 files
|
? PR-Agent usage:
Comment/help
on the PR to get a list of all available PR-Agent tools and their descriptions
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_joomlaupdate Libraries Front End Plugins |
Category | Suggestion | Score |
Possible bug |
Change the parameter type to
| 10 |
Add a null check for
| 7 | |
Add a null check for
| 7 | |
Possible issue |
Remove the redundant event dispatch call to avoid triggering the same event twiceThe administrator/components/com_joomlaupdate/src/Model/UpdateModel.php [887-888] -// @TODO: The event dispatched twice, here and at the end of current method. One of it should be removed.
-$app->getDispatcher()->dispatch('onJoomlaAfterUpdate', new AfterJoomlaUpdateEvent('onJoomlaAfterUpdate'));
+// Trigger event after joomla update.
+$app->getDispatcher()->dispatch('onJoomlaAfterUpdate', new AfterJoomlaUpdateEvent('onJoomlaAfterUpdate', [
+ 'oldVersion' => $oldVersion ?: '',
+]));
Suggestion importance[1-10]: 8Why: The suggestion is valid as it addresses a redundancy issue where an event is dispatched twice in the same method, which could lead to unintended behaviors or performance issues. | 8 |
Maintainability |
Use class constants for event names to avoid potential issues with method name changesTo avoid potential issues with method name changes, consider using class constants for the plugins/installer/override/src/Extension/Override.php [51-58] return [
- 'onExtensionBeforeUpdate' => 'onExtensionBeforeUpdate',
- 'onExtensionAfterUpdate' => 'onExtensionAfterUpdate',
- 'onJoomlaBeforeUpdate' => 'onJoomlaBeforeUpdate',
- 'onJoomlaAfterUpdate' => 'onJoomlaAfterUpdate',
- 'onInstallerBeforeInstaller' => 'onInstallerBeforeInstaller',
- 'onInstallerAfterInstaller' => 'onInstallerAfterInstaller',
+ self::EVENT_EXTENSION_BEFORE_UPDATE => 'onExtensionBeforeUpdate',
+ self::EVENT_EXTENSION_AFTER_UPDATE => 'onExtensionAfterUpdate',
+ self::EVENT_JOOMLA_BEFORE_UPDATE => 'onJoomlaBeforeUpdate',
+ self::EVENT_JOOMLA_AFTER_UPDATE => 'onJoomlaAfterUpdate',
+ self::EVENT_INSTALLER_BEFORE_INSTALLER => 'onInstallerBeforeInstaller',
+ self::EVENT_INSTALLER_AFTER_INSTALLER => 'onInstallerAfterInstaller',
];
Suggestion importance[1-10]: 7Why: Using class constants for event names is a good practice for maintainability and avoids hard-coding strings, which can lead to errors if event names change. | 7 |
Enhancement |
Add a constructor to the class to initialize properties or perform necessary setupAdd a constructor to the libraries/src/Event/Extension/BeforeJoomlaUpdateEvent.php [21-23] class BeforeJoomlaUpdateEvent extends AbstractJoomlaUpdateEvent
{
+ public function __construct()
+ {
+ // Initialize properties or perform setup
+ parent::__construct();
+ }
}
Suggestion importance[1-10]: 5Why: Adding a constructor might be beneficial for initializing properties or performing setup, but it's not strictly necessary unless there's specific initialization required, which isn't indicated in the PR or the suggestion. | 5 |
Labels |
Added:
Feature
PR-5.2-dev
Enhancement
Review effort [1-5]: 3
|
I have tested this item ✅ successfully on 2461713
Installed multiple extensions (and updated 1 of them and uninstalled them - just in case) successfully..
I have tested this item ✅ successfully on 2461713
Installation extensions still works after applying patch. Site also still works.
? no. Can I do that on a PBF server site?
I have not tested this item.
Install and uninstall of Extension works as expected.
I have tested this item ✅ successfully on 2461713
Install and uninstall of Extension works as expected.
? no. Can I do that on a PBF server site?
@crommie I think yes. They can later revert it to the initial state, as far as I know.
Just checking: does "reinstall core files" use the same process or is that entirely different?
@crommie Reinstall core is ok, that also uses the Joomla Update component as if it was an update.
P.S.: But you should be on the custom update URL created by Drone for this PR so the PR is still applied after the update.
Hi @richard67,
Based on your comment, I tested the Joomla Update process for this PR and it worked :)
Thanks.
Sure @richard67 , I will submit it again.
Olivier just told me he didn't have rights to restore the human tests. ;(
I have tested this item ✅ successfully on dcf15b1
I have tested this item successfully
Installed multiple extensions (and updated 1 of them and uninstalled them - just in case) successfully..
I also tested the Joomla Update process.
I have tested this item ✅ successfully on dcf15b1
Status | Pending | ⇒ | Ready to Commit |
RTC
Labels |
Added:
RTC
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-08-28 13:48:00 |
Closed_By | ⇒ | Hackwar |
PR Review ?
3, because the PR involves multiple files and changes related to event handling in a complex system like Joomla. Understanding the context and ensuring that the new event classes integrate seamlessly with the existing system requires a moderate level of effort.
No
Duplicate Event Dispatch: In
UpdateModel.php
, theAfterJoomlaUpdateEvent
is dispatched twice in close succession within thecleanUp
method. This could lead to unintended side effects or duplicate processing. One of these dispatches should likely be removed to prevent potential issues.No