Commit e18554d5 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer

Version 1.0: Tiny system plugin to make sure VM is loaded during plugin...

Version 1.0: Tiny system plugin to make sure VM is loaded during plugin updates from the Joomla plugin updater component
parents
This diff is collapsed.
BASE=vmLoaderPluginUpdate
PLUGINTYPE=system
VERSION=1.0
PLUGINFILES=$(BASE).php $(BASE).xml index.html
SYSTRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).*sys.ini)
NONSYSTRANSLATIONS=${SYSTRANSLATIONS:%.sys.ini=%.ini}
TRANSLATIONS=$(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) $(call wildcard,language/*/index.html)
ZIPFILE=plg_$(PLUGINTYPE)_$(BASE)_v$(VERSION).zip
all: zip
$(NONSYSTRANSLATIONS): %.ini: %.sys.ini
cp $< $@
zip: $(PLUGINFILES) $(TRANSLATIONS) $(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS)
@echo "Packing all files into distribution file $(ZIPFILE):"
@zip -r $(ZIPFILE) $(PLUGINFILES) LICENSE.txt
# @zip -r $(ZIPFILE) $(TRANSLATIONS)
clean:
rm -f $(ZIPFILE)
<?php
/**
* @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();
}
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.0" type="plugin" group="system" method="upgrade">
<name>VM Framework Loader during Plugin Updates</name>
<creationDate>2017-08-06</creationDate>
<author>Reinhold Kainhofer</author>
<copyright>Copyright (C) 2017 Reinhold Kainhofer.</copyright>
<license>http://www.gnu.org/licenses/gpl.html GNU/GPL v3+</license>
<authorEmail>office@open-tools.net</authorEmail>
<authorUrl>http://www.virtuemart.net/</authorUrl>
<version>1.0</version>
<description>Makes sure the VirtueMart framework is loaded during automatic plugin updates using Joomla's plugin updater.</description>
<files>
<filename plugin="vmLoaderPluginUpdate">vmLoaderPluginUpdate.php</filename>
<filename>index.html</filename>
</files>
<config>
</config>
<updateservers>
<!--server type="extension" name="VM Auto Parent Categories Updates"><![CDATA[http://open-tools.net/UpdateServer/index.php?package=Joomla&amp;extension=vmLoaderPluginUpdate&amp;file=extension.xml]]></server-->
</updateservers>
</extension>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment