Create a plugin - plg_mycomponent_something
XML Manifest looks like this
<extension type="plugin" version="4.0" method="upgrade" group="mycomponent">
PHP code looks like this
class plgMycomponentSomething extends mycomponentPlugin
{
// This will only ever be used by mycomponent when mycomponentPlugin is defined
Some function...
}
Install the plugin.
Changed the version number in the XML.
Use the updater to update it
The updater will install the new version
Get error
Class mycomponentPlugin not found
Joomla 4.2.0
Problem cause by lines 587-592 of UpdateModel.php
I suggest adding an Exception catcher like this...
// If we have a plugin, we can use the plugin trigger "onInstallerBeforePackageDownload"
// But we should make sure, that our plugin is loaded, so we don't need a second "installer" plugin
case 'plugin':
$cname = str_replace('plg_', '', $table->element);
try
{
PluginHelper::importPlugin($table->folder, $cname);
}
catch ( Exception $e )
{
; // Ignore
}
break;
Those who want to use onInstallerBeforePackageDownload will have to ensure the class mycomponentPlugin gets loaded somehow.
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Could be a possibility when the component has been written for Joomla 4 from scratch. Not going to work with a load of legacy stuff. Also affects a large number of plugins, so a generic solution would be better.
A generic solution also means that only developers of plugins which use 'onInstallerBeforePackageDownload' or similar need to think about it.
Labels |
Added:
bug
|
Maybe it needs to have a namespace in the XML like e.g. here? https://github.com/joomla/joomla-cms/blob/4.2-dev/plugins/actionlog/joomla/joomla.xml#L12