Automatic updates for extension-specific plugins fail since Joomla 3.7...

108 views
Skip to first unread message

reinhold....@gmail.com

unread,
Aug 3, 2017, 4:55:56 AM8/3/17
to Joomla! General Development
Hello,
Since Joomla 3.7 the Joomla plugin updater appears to try to load a plugin before a plugin update is executed (so a possible trigger onInstallerBeforePackageDownload is available). This is done in administrator/components/com_installer/models/update.php, function preparePreUpdate.
Whenever the plugin is updated through the plugin updater, it is now explicitly loaded by a call to JPluginHelper::importPlugin. Unfortunately, only the plugin itself is loaded.

Now, the problem is with extension-specific plugins, like plugins for VirtueMart, that they are loaded from within that extension and typically assume that the parent extension is already loaded. So these plugins typically do NOT load the parent extension (e.g. VirtueMart) themselves any more. At least until now there was no reason to try to load the parent extension.

As an example, all shipping and payment plugins for VirtueMart I have seen simply start like:

<?php
defined ('_JEXEC') or die('Restricted access');
if (!class_exists ('vmPSPlugin')) {
       
require(JPATH_VM_PLUGINS . '/vmpsplugin.php');
}
[...]


This will fail with an error message when the plugin is updated through the Joomla plugin updater:
Notice: Use of undefined constant JPATH_VM_PLUGINS - assumed 'JPATH_VM_PLUGINS' in /var/www/html/plugins/vmshipment/rules_shipping_advanced/rules_shipping_advanced.php on line 23
Warning: require(JPATH_VM_PLUGINS/vmpsplugin.php): failed to open stream: No such file or directory in /var/www/html/plugins/vmshipment/rules_shipping_advanced/rules_shipping_advanced.php on line 23
Fatal error: require(): Failed opening required 'JPATH_VM_PLUGINS/vmpsplugin.php' (include_path='.:/usr/local/lib/php') in /var/www/html/plugins/vmshipment/rules_shipping_advanced/rules_shipping_advanced.php on line 23


The behaviour is particularly annoying, as developers can not provide any automatic update to fix this issue, as the update itself is broken...

I think it is a good idea to load plugins before updating so a trigger is available. But this approach potentially breaks all extension-specific plugins, which so far assumed that the parent extension was properly loaded and initialized, since the only place they were loaded was from within the parent extension.

Is there any way to prevent the plugin updater from trying to load extension-specific plugins? 
Any other ideas how to make automatic updates for existing, installed extension-specific plugins work (short of modifying all existing plugins to try to load the parent extension just in case)?

Thanks,
Reinhold

PS: Manually installing the .zip file of the new version works fine to update the plugin, but the Joomla plugin updater (which is now more or less forced by the JED) triggers this problem.

Reply all
Reply to author
Forward
0 new messages