31
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-06-03 22:20:48 +00:00

Refactor install script to use JInstallerScript, bump to 3.6 minimum

This commit is contained in:
Michael Babker 2016-06-19 10:17:11 -05:00
parent dbaeefa3aa
commit 9441b0103d
3 changed files with 25 additions and 26 deletions

View File

@ -6,5 +6,4 @@
COM_PATCHTESTER="Joomla! Patch Tester"
COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES="Could not install the template overrides for the following templates: %s"
COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES="Could not remove the template overrides for the following templates: %s"
COM_PATCHTESTER_ERROR_INSTALL_JVERSION="The Joomla! Patch Tester requires version %s or newer of the CMS"
COM_PATCHTESTER_XML_DESCRIPTION="Component for pull request management testing"

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="component" version="3.5" method="upgrade">
<extension type="component" version="3.6" method="upgrade">
<name>com_patchtester</name>
<author>Joomla! Project</author>
<creationDate>11-May-2016</creationDate>

View File

@ -11,16 +11,8 @@
*
* @since 2.0
*/
class Com_PatchtesterInstallerScript
class Com_PatchtesterInstallerScript extends JInstallerScript
{
/**
* Minimum supported version of the CMS
*
* @var string
* @since 2.0
*/
protected $minCmsVersion = '3.5';
/**
* Array of templates with supported overrides
*
@ -30,25 +22,18 @@ class Com_PatchtesterInstallerScript
protected $templateOverrides = array('hathor');
/**
* Function to act prior to installation process begins
* Extension script constructor.
*
* @param string $type The action being performed
* @param JInstallerAdapterComponent $parent The class calling this method
*
* @return boolean True on success
*
* @since 2.0
* @since __DEPLOY_VERSION__
*/
public function preflight($type, $parent)
public function __construct()
{
if (version_compare(JVERSION, $this->minCmsVersion, 'lt'))
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_ERROR_INSTALL_JVERSION', $this->minCmsVersion));
$this->minimumJoomla = '3.6';
$this->minimumPhp = JOOMLA_MINIMUM_PHP;
return false;
}
return true;
$this->deleteFolders = array(
'/administrator/components/com_patchtester/PatchTester/Table',
);
}
/**
@ -120,6 +105,21 @@ class Com_PatchtesterInstallerScript
}
}
/**
* Function to perform changes during postflight
*
* @param string $type The action being performed
* @param JInstallerAdapterComponent $parent The class calling this method
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function postflight($type, $parent)
{
$this->removeFiles();
}
/**
* Function to copy layout overrides for core templates at install or update
*