No Code Attached Yet bug
avatar BrainforgeUK
BrainforgeUK
28 Aug 2022

Steps to reproduce the issue

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

Expected result

The updater will install the new version

Actual result

Get error
Class mycomponentPlugin not found

System information (as much as possible)

Joomla 4.2.0

Additional comments

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.

avatar BrainforgeUK BrainforgeUK - open - 28 Aug 2022
avatar BrainforgeUK BrainforgeUK - change - 28 Aug 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 28 Aug 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Aug 2022
avatar richard67
richard67 - comment - 28 Aug 2022

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

avatar BrainforgeUK
BrainforgeUK - comment - 29 Aug 2022

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.

avatar Hackwar Hackwar - change - 17 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 17 Feb 2023
avatar Hackwar Hackwar - close - 10 Oct 2024
avatar Hackwar
Hackwar - comment - 10 Oct 2024

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.

avatar Hackwar Hackwar - change - 10 Oct 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-10-10 07:36:27
Closed_By Hackwar

Add a Comment

Login with GitHub to post a comment