VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: pschmehl on October 05, 2017, 04:51:33 AM

Title: Virtuemart uninstall causing updates to fail
Post by: pschmehl on October 05, 2017, 04:51:33 AM
I installed the current version of Virtuemart on Joomla 3.8.1 to try it out. Then I uninstalled it. Apparently the uninstall didn't completely uninstall Virtuemart, because I'm getting the following error when I try to update plugins:
QuoteWarning: require(Sites/www.vvfh.org/administrator/components/com_virtuemart/helpers/config.php): failed to open stream: No such file or directory in Sites/www.vvfh.org/plugins/system/vmLoaderPluginUpdate/vmLoaderPluginUpdate.php on line 38 Fatal error: require(): Failed opening required 'Sites/www.vvfh.org/administrator/components/com_virtuemart/helpers/config.php' (include_path='.:/usr/local/share/pear') in Sites/www.vvfh.org/plugins/system/vmLoaderPluginUpdate/vmLoaderPluginUpdate.php on line 38
I checked the database and discovered that all of the Virtuemart tables are still there.

Is that normal? Is there a script to remove them? I'd rather not remove them one at a time.
Title: Re: Virtuemart uninstall causing updates to fail
Post by: pschmehl on October 07, 2017, 07:50:43 AM
I went into plugins/system/vmLoaderPluginUpdate/vmLoaderPluginUpdate.php and edited it, commenting out the offending section. Is this a virtuemart file? Why were the database tables not removed when I ran the uninstall? Is that normal for Joomla extensions?

/**
* @plugin vmLoaderPluginUpdate
* Version 1.0, 2017-08-06
* @author Reinhold Kainhofer, Open Tools
* @copyright Copyright (C) 2017 Reinhold Kainhofer - All rights reserved.
* @license - http://www.gnu.org/licenses/gpl.html GNU/GPL

* The Joomla 3.7+ plugin updater tries to load the plugin before
* updating. Since many plugins in the past assumed that they could only
* be loaded from within VM, the plugins never load the VM framework,
* so loading the plugin from the updater fails.
*
* This plugin makes sure that, when a plugin update is run, the VM
* config is loaded properly.
**/

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.event.plugin');

class plgSystemVmLoaderPluginUpdate extends JPlugin {
        function __construct(&$subject, $config = array()) {
                parent::__construct($subject, $config);
                # Only for Joomla 3.7 and above:
                # If a plugin update is run (option=com_installer&view=update&task=update.update),
                # then load the VM config. This approach will load VM even for non-VM
                # plugins, but the overhead of checking whether the updated plugin
                # really requires VM is way too large compared to the performance hit
                # of loading VM even for non-VM plugins.
                if(version_compare(JVERSION,'3.7.0','ge')) {
                        $jinput = JFactory::getApplication()->input;
                        $option = $jinput->get('option');
                        $view = $jinput->get('view');
                        $task = $jinput->get('task');
/**                     if ($option == 'com_installer' && $view == 'update' && $task == 'update.update') {
                                if (!class_exists( 'VmConfig' )) {
                                        require(JPATH_ADMINISTRATOR .'/components/com_virtuemart/helpers/config.php');
                                        VmConfig::loadConfig();
                                }
                        } **/
                }
        }

}
Title: Re: Virtuemart uninstall causing updates to fail
Post by: jenkinhill on October 07, 2017, 13:07:45 PM
Yes, vmLoaderPluginUpdate is a VirtueMart system plugin.  Uninstalling is covered in  this:  http://forum.virtuemart.net/index.php?topic=134060.msg465429#msg465429
Title: Re: Virtuemart uninstall causing updates to fail
Post by: pschmehl on October 07, 2017, 18:23:45 PM
Thanks. That was very helpful. Is there a script to remove the db tables? I don't use phpmyadmin. I prefer not to expose the db to the internet in any way, so I always listen on localhost only and do all my db work from the commandline.
Title: Re: Virtuemart uninstall causing updates to fail
Post by: jenkinhill on October 07, 2017, 19:05:12 PM
http://forum.virtuemart.net/index.php?topic=134060.msg486184
Title: Re: Virtuemart uninstall causing updates to fail
Post by: Studio 42 on October 13, 2017, 23:49:03 PM
For the DB, you had to remove it before uninstall Virtuemart.(easy way > install again VM > in tools : "remove database" and uninstall VM after)
For any plugin, you can disable it, if the admin is full broken, simply rename the right plugin folder and it's not loaded anymore.