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
|
Thank you for reporting this. I'm sorry, that handling this PR took so long. I've been thinking about this for some time and unfortunately I have to say I disagree with your assessment that this is a bug on Joomlas part. If your code (regardless of it being a plugin or not) is called in the context of Joomla, you either have to register any dependencies in the autoloader OR make sure that the code loads the right dependencies in that file beforehand. If your plugin extends from another base class and that base class is not available through the autoloader, it is the plugin developers job to make sure that the right file is included. Thus this would make this a bug of the plugin developer and not of Joomla. Because of that, I'm going to close this issue. If you feel like this is in error, please create a new issue.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-10-10 07:36:27 |
Closed_By | ⇒ | Hackwar |
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