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

Add a Comment

Login with GitHub to post a comment