Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
ef57f8bd5f | |||
9d3a1f6ac6 | |||
b6ad804633 | |||
393b7b37c4 | |||
899fcf304a | |||
9b36213aef | |||
8f2384a449 | |||
c7338fe6af | |||
7d189ecc93 | |||
92dfce2457 | |||
e022c6d727 | |||
85ea763c3c | |||
bb15917b42 | |||
2f564337cd | |||
251ee285b4 | |||
163f8232a7 | |||
7242166e5b | |||
3506fb1a3f | |||
9f3aeff78a | |||
e9fb7e4ce3 | |||
fb032a4f79 | |||
0af86a232c | |||
3b9ef6cb5d | |||
f0188d00cc | |||
48eb235886 | |||
7a25e82631 | |||
6c084e1020 | |||
aa99a3424a | |||
3b75db13cb | |||
a71266e235 | |||
9db558acb7 | |||
519be7a111 | |||
11cc628e33 | |||
46a60d4d37 | |||
5344035c04 | |||
9488c95a3b | |||
6f0c5ded1a | |||
1a5583af29 | |||
1e8f174933 |
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" version="4.0" group="extension" method="upgrade">
|
||||
<extension type="plugin" version="5.0" group="extension" method="upgrade">
|
||||
<name>PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER</name>
|
||||
<creationDate>7th November, 2024</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
|
118
script.php
118
script.php
@ -13,9 +13,11 @@
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Version;
|
||||
use Joomla\CMS\Installer\InstallerAdapter;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Filesystem\File;
|
||||
use Joomla\CMS\Filesystem\Folder;
|
||||
use Joomla\Filesystem\File;
|
||||
use Joomla\Filesystem\Folder;
|
||||
|
||||
/**
|
||||
* Extension - Componentbuilder Export Compiler script file.
|
||||
@ -24,4 +26,116 @@ use Joomla\CMS\Filesystem\Folder;
|
||||
*/
|
||||
class plgExtensionComponentbuilderExportCompilerInstallerScript
|
||||
{
|
||||
/**
|
||||
* The CMS Application.
|
||||
*
|
||||
* @since 4.4.2
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* A list of files to be deleted
|
||||
*
|
||||
* @var array
|
||||
* @since 3.6
|
||||
*/
|
||||
protected array $deleteFiles = [];
|
||||
|
||||
/**
|
||||
* A list of folders to be deleted
|
||||
*
|
||||
* @var array
|
||||
* @since 3.6
|
||||
*/
|
||||
protected array $deleteFolders = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param InstallerAdapter $adapter The object responsible for running this script
|
||||
*/
|
||||
public function __construct($adapter)
|
||||
{
|
||||
// get application
|
||||
$this->app = Factory::getApplication();
|
||||
|
||||
if (is_file(JPATH_ROOT . '/plugins/extension/componentbuilderexportcompiler/componentbuilderexportcompiler.php'))
|
||||
{
|
||||
$this->deleteFiles[] = '/plugins/extension/componentbuilderexportcompiler/componentbuilderexportcompiler.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called before any type of action
|
||||
*
|
||||
* @param string $route Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param InstallerAdapter $adapter The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function preflight($route, $adapter)
|
||||
{
|
||||
// set application to local method var, just use $this->app in future [we will drop $app in J6]
|
||||
$app = $this->app;
|
||||
|
||||
// the default for both install and update
|
||||
$jversion = new Version();
|
||||
if (!$jversion->isCompatible('5.0.0'))
|
||||
{
|
||||
$app->enqueueMessage('Please upgrade to at least Joomla! 5.0.0 before continuing!', 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove old files and folders
|
||||
$this->removeFiles();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called before any type of action
|
||||
*
|
||||
* @param string $route Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param InstallerAdapter $adapter The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function postflight($route, $adapter)
|
||||
{
|
||||
// set application to local method var, just use $this->app in future [we will drop $app in J6]
|
||||
$app = $this->app;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the files and folders in the given array from
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function removeFiles()
|
||||
{
|
||||
if (!empty($this->deleteFiles))
|
||||
{
|
||||
foreach ($this->deleteFiles as $file)
|
||||
{
|
||||
if (is_file(JPATH_ROOT . $file) && !File::delete(JPATH_ROOT . $file))
|
||||
{
|
||||
echo Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $file) . '<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($this->deleteFolders))
|
||||
{
|
||||
foreach ($this->deleteFolders as $folder)
|
||||
{
|
||||
if (is_dir(JPATH_ROOT . $folder) && !Folder::delete(JPATH_ROOT . $folder))
|
||||
{
|
||||
echo Text::sprintf('JLIB_INSTALLER_ERROR_FILE_FOLDER', $folder) . '<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\DI\Container;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Plugin\Extension\ComponentbuilderExportCompiler\Extension\ComponentbuilderExportCompiler;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
|
@ -10,7 +10,6 @@
|
||||
*/
|
||||
namespace VDM\Plugin\Extension\ComponentbuilderExportCompiler\Extension;
|
||||
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory;
|
||||
|
Loading…
Reference in New Issue
Block a user