Component-Builder-fork/admin/compiler/joomla_3/script.php

125 lines
3.7 KiB
PHP
Raw Normal View History

2016-01-30 20:28:43 +00:00
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
* @copyright Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
2016-01-30 20:28:43 +00:00
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.modal');
/**
* Script File of ###Component### Component
*/
class com_###component###InstallerScript
{
/**
* Constructor
2016-01-30 20:28:43 +00:00
*
* @param JAdapterInstance $parent The object responsible for running this script
2016-01-30 20:28:43 +00:00
*/
public function __construct(JAdapterInstance $parent) {}
2016-01-30 20:28:43 +00:00
/**
* Called on installation
*
* @param JAdapterInstance $parent The object responsible for running this script
*
* @return boolean True on success
*/
public function install(JAdapterInstance $parent) {}
2016-01-30 20:28:43 +00:00
/**
* Called on uninstallation
2016-01-30 20:28:43 +00:00
*
* @param JAdapterInstance $parent The object responsible for running this script
2016-01-30 20:28:43 +00:00
*/
public function uninstall(JAdapterInstance $parent)
2016-01-30 20:28:43 +00:00
{###UNINSTALLSCRIPT###
// little notice as after service, in case of bad experience with component.
echo '<h2>Did something go wrong? Are you disappointed?</h2>
<p>Please let me know at <a href="mailto:###AUTHOREMAIL###">###AUTHOREMAIL###</a>.
<br />We at ###COMPANYNAME### are committed to building extensions that performs proficiently! You can help us, really!
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
<br />Visit us at <a href="###AUTHORWEBSITE###" target="_blank">###AUTHORWEBSITE###</a> today!</p>';
}
/**
* Called on update
2016-01-30 20:28:43 +00:00
*
* @param JAdapterInstance $parent The object responsible for running this script
*
* @return boolean True on success
2016-01-30 20:28:43 +00:00
*/
public function update(JAdapterInstance $parent){}
2016-01-30 20:28:43 +00:00
/**
* Called before any type of action
2016-01-30 20:28:43 +00:00
*
* @param string $type Which action is happening (install|uninstall|discover_install|update)
* @param JAdapterInstance $parent The object responsible for running this script
*
* @return boolean True on success
2016-01-30 20:28:43 +00:00
*/
public function preflight($type, JAdapterInstance $parent)
2016-01-30 20:28:43 +00:00
{
// get application
$app = JFactory::getApplication();
// is redundant or so it seems ...hmmm let me know if it works again
if ($type === 'uninstall')
{
2016-01-30 20:28:43 +00:00
return true;
}
// the default for both install and update
2016-01-30 20:28:43 +00:00
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
2016-01-30 20:28:43 +00:00
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
2016-01-30 20:28:43 +00:00
return false;
}
// do any updates needed
if ($type === 'update')
{###PREUPDATESCRIPT###
}
// do any install needed
if ($type === 'install')
{###PREINSTALLSCRIPT###
}
return true;
2016-01-30 20:28:43 +00:00
}
/**
* Called after any type of action
*
* @param string $type Which action is happening (install|uninstall|discover_install|update)
* @param JAdapterInstance $parent The object responsible for running this script
2016-01-30 20:28:43 +00:00
*
* @return boolean True on success
2016-01-30 20:28:43 +00:00
*/
public function postflight($type, JAdapterInstance $parent)
2016-01-30 20:28:43 +00:00
{
// get application
$app = JFactory::getApplication();###MOVEFOLDERSSCRIPT###
2016-01-30 20:28:43 +00:00
// set the default component settings
if ($type === 'install')
{###POSTINSTALLSCRIPT###
2016-01-30 20:28:43 +00:00
}
// do any updates needed
if ($type === 'update')
{###POSTUPDATESCRIPT###
2016-01-30 20:28:43 +00:00
}
return true;
}###MOVEFOLDERSMETHOD###
2016-01-30 20:28:43 +00:00
}