Release of v5.0.2-alpha3

Fix database mySql update in J4+. Remove phpspreadsheet completely from Joomla 4+. Add option to use powers in preflight event in the installer class.
This commit is contained in:
Robot 2024-07-27 22:55:29 +02:00
parent 0cbe573fe0
commit c8b65b3b0b
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
25 changed files with 928 additions and 356 deletions

View File

@ -1,9 +1,8 @@
# v5.0.2-alpha2
# v5.0.2-alpha3
- Fix missing scripts and styles fields and methods in the site admin view model
- Update subform field layout across JCB for cleaner look
- Remove expansion feature
- Fix helper area
- Fix database mySql update in J4+
- Remove phpspreadsheet completely from Joomla 4+
- Add option to use powers in preflight event in the installer class
# v5.0.2-alpha
@ -11,7 +10,11 @@
- Fix permissions tab in items in J4+
- Fix site display controller checkEditId function in J4+
- Add class methods to the HtmlView classes in J4+
- Fix broken toolbar call in HtmlView in J4+
- Fix broken toolbar call in HtmlView in J4+
- Fix missing scripts and styles fields and methods in the site admin view model
- Update subform field layout across JCB for cleaner look
- Remove expansion feature
- Fix helper area
# v5.0.1

View File

@ -0,0 +1,60 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die;
// register additional namespace
spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/vendor_jcb/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
'libraries/vendor_jcb/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
'libraries/vendor_jcb/VDM.Joomla' => 'VDM\\Joomla',
'libraries/vendor_jcb/VDM.Minify' => 'VDM\\Minify',
'libraries/vendor_jcb/VDM.Psr' => 'VDM\\Psr'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = __DIR__ . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});

View File

@ -19,6 +19,7 @@ use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\Filesystem\Folder;
use Joomla\Database\DatabaseInterface;
use VDM\Joomla\Componentbuilder\PHPConfigurationChecker;
use VDM\Joomla\Componentbuilder\Table\SchemaChecker;
// No direct access to this file
@ -48,7 +49,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
/**
* The version number of the extension.
*
* @var string
* @var string
* @since 3.6
*/
protected $release;
@ -56,7 +57,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
/**
* The table the parameters are stored in.
*
* @var string
* @var string
* @since 3.6
*/
protected $paramTable;
@ -64,7 +65,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
/**
* The extension name. This should be set in the installer script.
*
* @var string
* @var string
* @since 3.6
*/
protected $extension;
@ -72,7 +73,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
/**
* A list of files to be deleted
*
* @var array
* @var array
* @since 3.6
*/
protected $deleteFiles = [];
@ -80,7 +81,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
/**
* A list of folders to be deleted
*
* @var array
* @var array
* @since 3.6
*/
protected $deleteFolders = [];
@ -88,7 +89,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
/**
* A list of CLI script files to be copied to the cli directory
*
* @var array
* @var array
* @since 3.6
*/
protected $cliScriptFiles = [];
@ -96,7 +97,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
/**
* Minimum PHP version required to install the extension
*
* @var string
* @var string
* @since 3.6
*/
protected $minimumPhp;
@ -104,7 +105,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
/**
* Minimum Joomla! version required to install the extension
*
* @var string
* @var string
* @since 3.6
*/
protected $minimumJoomla;
@ -158,7 +159,6 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function install(InstallerAdapter $adapter): bool {return true;}
@ -180,7 +180,6 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function uninstall(InstallerAdapter $adapter): bool
@ -525,7 +524,6 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function preflight(string $type, InstallerAdapter $adapter): bool
@ -573,16 +571,22 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
$this->removeFolder($cleaner);
}
// Check that the required configuration are set for PHP
$this->phpConfigurationCheck($this->app);
// Check that the PHP configurations are sufficient
if ($this->classExists(PHPConfigurationChecker::class))
{
(new PHPConfigurationChecker())->run();
}
}
// do any install needed
if ($type === 'install')
{
// Check that the required configuration are set for PHP
$this->phpConfigurationCheck($this->app);
// Check that the PHP configurations are sufficient
if ($this->classExists(PHPConfigurationChecker::class))
{
(new PHPConfigurationChecker())->run();
}
}
return true;
@ -595,7 +599,6 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function postflight(string $type, InstallerAdapter $adapter): bool
@ -3267,7 +3270,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 5.0.2-alpha2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
<h3>Upgrade to Version 5.0.2-alpha3 Was Successful! Let us know if anything is not working as expected.</h3></div>';
// Add/Update component in the action logs extensions table.
$this->setActionLogsExtensions();
@ -4105,7 +4108,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param array|null $ignore The folders and files to ignore and not remove.
*
* @return bool True if all specified files/folders are removed, false otherwise.
* @since 3.2.2
* @since 3.2.2
*/
protected function removeFolder(string $dir, ?array $ignore = null): bool
{
@ -4156,7 +4159,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param array $ignore The folders and files to ignore.
*
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
* @since 3.2.1
* @since 3.2.1
*/
protected function isDirEmpty(string $dir, array $ignore): bool
{
@ -4176,7 +4179,6 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* Remove the files and folders in the given array from
*
* @return void
*
* @since 3.6
*/
protected function removeFiles()
@ -4208,7 +4210,6 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* Moves the CLI scripts into the CLI folder in the CMS
*
* @return void
*
* @since 3.6
*/
protected function moveCliFiles()
@ -4239,7 +4240,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $contentHistoryOptions
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setContentType(
string $typeTitle,
@ -4301,7 +4302,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $textPrefix
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setActionLogConfig(
string $typeTitle,
@ -4354,7 +4355,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* Set action logs extensions integration
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setActionLogsExtensions(): void
{
@ -4395,7 +4396,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $rules The component rules
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setAssetsRules(string $rules): void
{
@ -4433,7 +4434,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $params The component rules
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setExtensionsParams(string $params): void
{
@ -4476,7 +4477,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $dataType This datatype we will change the rules column to if it to small.
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setDatabaseAssetsRulesFix(int $accessWorseCase, string $dataType): void
{
@ -4511,7 +4512,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param bool $fields The switch to also remove related field data
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeViewData(string $context, bool $fields = false): void
{
@ -4534,7 +4535,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeContentTypes(string $context): void
{
@ -4591,7 +4592,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFields(string $context): void
{
@ -4653,7 +4654,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param array $ids The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFieldsValues(string $context, array $ids): void
{
@ -4684,7 +4685,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFieldsGroups(string $context): void
{
@ -4739,7 +4740,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeViewHistory(string $context): void
{
@ -4771,7 +4772,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param array $ids The type ids
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeUcmBase(array $ids): void
{
@ -4804,7 +4805,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeUcmContent(string $context): void
{
@ -4836,7 +4837,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeContentItemTagMap(string $context): void
{
@ -4871,7 +4872,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeActionLogConfig(string $context): void
{
@ -4901,7 +4902,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* Remove Asset Table Integrated
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeAssetData(): void
{
@ -4929,7 +4930,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* Remove action logs extensions integrated
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeActionLogsExtensions(): void
{
@ -4959,7 +4960,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* Remove remove database fix (if possible)
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeDatabaseAssetsRulesFix(): void
{
@ -4997,134 +4998,35 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
* @param string $className The fully qualified name of the class to check.
*
* @return bool True if the class exists or was successfully loaded, false otherwise.
* @since 4.0.1
* @since 4.0.1
*/
protected function classExists(string $className): bool
{
if (!class_exists($className, true))
if (class_exists($className, true))
{
// The power autoloader for this project (JPATH_ADMINISTRATOR) area.
$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/src/Helper/PowerloaderHelper.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
return true;
}
// Check again if the class now exists after requiring the autoloader
if (!class_exists($className, true))
// Autoloaders to check
$autoloaders = [
__DIR__ . '/ComponentbuilderInstallerPowerloader.php',
JPATH_ADMINISTRATOR . '/components/com_componentbuilder/src/Helper/PowerloaderHelper.php'
];
foreach ($autoloaders as $autoloader)
{
if (file_exists($autoloader))
{
return false;
require_once $autoloader;
if (class_exists($className, true))
{
return true;
}
}
}
return true;
}
/**
* Define the required limits with specific messages for success and warning scenarios
*
* @var array
* @since 3.2.1
*/
protected array $requiredPHPConfigs = [
'upload_max_filesize' => [
'value' => '128M',
'success' => 'The upload_max_filesize is appropriately set to handle large files, which is essential for uploading substantial components and media.',
'warning' => 'The current upload_max_filesize may not support large file uploads effectively, potentially causing failures during component installation.'
],
'post_max_size' => [
'value' => '128M',
'success' => 'The post_max_size setting is sufficient to manage large data submissions, ensuring smooth data processing within forms and uploads.',
'warning' => 'An insufficient post_max_size can lead to truncated data submissions, affecting form functionality and data integrity.'
],
'max_execution_time' => [
'value' => 60,
'success' => 'Max execution time is set high enough to execute complex operations without premature termination, which is crucial for lengthy operations.',
'warning' => 'A low max execution time could lead to script timeouts, especially during intensive operations, which might interrupt execution and cause failures during the compiling of a large extension.'
],
'max_input_vars' => [
'value' => 7000,
'success' => 'The max_input_vars setting supports a high number of input variables, facilitating complex forms and detailed component configurations.',
'warning' => 'Too few max_input_vars may result in lost data during processing complex forms, which can lead to incomplete configurations and operational issues.'
],
'max_input_time' => [
'value' => 60,
'success' => 'Max input time is adequate for processing inputs efficiently during high-load operations, ensuring no premature timeouts.',
'warning' => 'An insufficient max input time could result in incomplete data processing during input-heavy operations, potentially leading to errors and data loss.'
],
'memory_limit' => [
'value' => '256M',
'success' => 'The memory limit is set high to accommodate extensive operations and data processing, which enhances overall performance and stability.',
'warning' => 'A low memory limit can lead to frequent crashes and performance issues, particularly when processing large amounts of data or complex calculations.'
]
];
/**
* Helper function to convert PHP INI memory values to bytes
*
* @param string $value The value to convert
*
* @return int The bytes value
* @since 3.2.1
*/
protected function convertToBytes(string $value): int
{
$value = trim($value);
$lastChar = strtolower($value[strlen($value) - 1]);
$numValue = substr($value, 0, -1);
switch ($lastChar)
{
case 'g':
return $numValue * 1024 * 1024 * 1024;
case 'm':
return $numValue * 1024 * 1024;
case 'k':
return $numValue * 1024;
default:
return (int) $value;
}
}
/**
* Check that the required configurations are set for PHP
*
* @param $app The application
*
* @return void
* @since 3.2.1
*/
protected function phpConfigurationCheck($app): void
{
$showHelp = false;
// Check each configuration and provide detailed feedback
foreach ($this->requiredPHPConfigs as $configName => $configDetails)
{
$currentValue = ini_get($configName);
if ($currentValue === false)
{
$app->enqueueMessage("Error: Unable to retrieve current setting for '{$configName}'.", 'error');
continue;
}
$isMemoryValue = strpbrk($configDetails['value'], 'KMG') !== false;
$requiredValueBytes = $isMemoryValue ? $this->convertToBytes($configDetails['value']) : (int) $configDetails['value'];
$currentValueBytes = $isMemoryValue ? $this->convertToBytes($currentValue) : (int) $currentValue;
$conditionMet = $currentValueBytes >= $requiredValueBytes;
$messageType = $conditionMet ? 'message' : 'warning';
$messageText = $conditionMet ?
"Success: {$configName} is set to {$currentValue}. " . $configDetails['success'] :
"Warning: {$configName} configuration should be at least {$configDetails['value']} but is currently {$currentValue}. " . $configDetails['warning'];
$showHelp = ($showHelp || $messageType === 'warning') ? true : false;
$app->enqueueMessage($messageText, $messageType);
}
if ($showHelp)
{
$app->enqueueMessage('To optimize your Joomla Component Builder (JCB) development environment, specific PHP settings must be enhanced.<br>These settings are crucial for ensuring the successful installation and compilation of extensions.<br>We\'ve identified that certain configurations currently do not meet the recommended standards.<br>To adjust these settings and prevent potential issues, please consult our detailed guide available at <a href="https://git.vdm.dev/joomla/Component-Builder/wiki/PHP-Settings" target="_blank">JCB PHP Settings Wiki</a>.
', 'notice');
}
return false;
}
/**

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.2-alpha2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.2-alpha3) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,13 +144,13 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 26th July, 2024
+ *Version*: 5.0.2-alpha2
+ *Last Build*: 27th July, 2024
+ *Version*: 5.0.2-alpha3
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **790300**
+ *Line count*: **792027**
+ *Field count*: **2099**
+ *File count*: **5505**
+ *File count*: **5521**
+ *Folder count*: **552**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.2-alpha2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.2-alpha3) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,13 +144,13 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 26th July, 2024
+ *Version*: 5.0.2-alpha2
+ *Last Build*: 27th July, 2024
+ *Version*: 5.0.2-alpha3
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **790300**
+ *Line count*: **792027**
+ *Field count*: **2099**
+ *File count*: **5505**
+ *File count*: **5521**
+ *Folder count*: **552**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).

View File

@ -28,6 +28,8 @@ HTML::_('bootstrap.renderModal');
/**
* Script File of ###Component### Component
*
* @since 1.5.0
*/
class Com_###Component###InstallerScript
{
@ -35,6 +37,7 @@ class Com_###Component###InstallerScript
* Constructor
*
* @param ComponentAdapter $parent The object responsible for running this script
* @since 1.5.0
*/
public function __construct(ComponentAdapter $parent) {}
@ -44,6 +47,7 @@ class Com_###Component###InstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function install(ComponentAdapter $parent) {}
@ -51,6 +55,8 @@ class Com_###Component###InstallerScript
* Called on uninstallation
*
* @param ComponentAdapter $parent The object responsible for running this script
*
* @since 1.5.0
*/
public function uninstall(ComponentAdapter $parent)
{###UNINSTALLSCRIPT###
@ -68,6 +74,7 @@ class Com_###Component###InstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function update(ComponentAdapter $parent){}
@ -78,6 +85,7 @@ class Com_###Component###InstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function preflight($type, ComponentAdapter $parent)
{
@ -121,6 +129,7 @@ class Com_###Component###InstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function postflight($type, ComponentAdapter $parent)
{
@ -144,7 +153,7 @@ class Com_###Component###InstallerScript
* @param array|null $ignore The folders and files to ignore and not remove.
*
* @return bool True if all specified files/folders are removed, false otherwise.
* @since 3.2.2
* @since 3.2.2
*/
protected function removeFolder(string $dir, ?array $ignore = null): bool
{
@ -195,7 +204,7 @@ class Com_###Component###InstallerScript
* @param array $ignore The folders and files to ignore.
*
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
* @since 3.2.1
* @since 3.2.1
*/
protected function isDirEmpty(string $dir, array $ignore): bool
{
@ -217,7 +226,7 @@ class Com_###Component###InstallerScript
* @input array The array to check
*
* @returns bool/int number of items in array on success
* @since 3.2.2
* @since 3.2.2
*/
protected function checkArray($array, $removeEmptyString = false)
{
@ -247,20 +256,31 @@ class Com_###Component###InstallerScript
* @param string $className The fully qualified name of the class to check.
*
* @return bool True if the class exists or was successfully loaded, false otherwise.
* @since 3.2.2
* @since 3.2.2
*/
protected function classExists(string $className): bool
{
if (!class_exists($className, true))
if (class_exists($className, true))
{
###THREE_POWER_AUTOLOADER###
return true;
}
// Check again if the class now exists after requiring the autoloader
if (!class_exists($className, true))
// Autoloaders to check
$autoloaders = [###INSTALLER_POWER_AUTOLOADER_ARRAY###];
foreach ($autoloaders as $autoloader)
{
if (file_exists($autoloader))
{
return false;
require_once $autoloader;
if (class_exists($className, true))
{
return true;
}
}
}
return true;
return false;
}###INSTALLERMETHODS###
}

View File

@ -0,0 +1,18 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die;###INSTALLER_POWER_HELPER###

View File

@ -184,6 +184,12 @@
"rename": false,
"type": "file"
},
"script_powerloader.php": {
"naam": "script_powerloader.php",
"path": "c0mp0n3nt/",
"rename": false,
"type": "file"
},
"install.mysql.utf8.sql": {
"naam": "install.mysql.utf8.sql",
"path": "c0mp0n3nt/admin/sql",

View File

@ -0,0 +1,18 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this JCB template file (EVER)
defined('_JCB_TEMPLATE') or die;
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die;###INSTALLER_POWER_HELPER###

View File

@ -52,7 +52,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* The version number of the extension.
*
* @var string
* @var string
* @since 3.6
*/
protected $release;
@ -60,7 +60,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* The table the parameters are stored in.
*
* @var string
* @var string
* @since 3.6
*/
protected $paramTable;
@ -68,7 +68,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* The extension name. This should be set in the installer script.
*
* @var string
* @var string
* @since 3.6
*/
protected $extension;
@ -76,7 +76,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* A list of files to be deleted
*
* @var array
* @var array
* @since 3.6
*/
protected $deleteFiles = [];
@ -84,7 +84,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* A list of folders to be deleted
*
* @var array
* @var array
* @since 3.6
*/
protected $deleteFolders = [];
@ -92,7 +92,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* A list of CLI script files to be copied to the cli directory
*
* @var array
* @var array
* @since 3.6
*/
protected $cliScriptFiles = [];
@ -100,7 +100,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* Minimum PHP version required to install the extension
*
* @var string
* @var string
* @since 3.6
*/
protected $minimumPhp;
@ -108,7 +108,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
/**
* Minimum Joomla! version required to install the extension
*
* @var string
* @var string
* @since 3.6
*/
protected $minimumJoomla;
@ -162,7 +162,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function install(InstallerAdapter $adapter): bool {return true;}
@ -184,7 +183,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function uninstall(InstallerAdapter $adapter): bool
@ -207,7 +205,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function preflight(string $type, InstallerAdapter $adapter): bool
@ -252,7 +249,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function postflight(string $type, InstallerAdapter $adapter): bool
@ -284,7 +280,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param array|null $ignore The folders and files to ignore and not remove.
*
* @return bool True if all specified files/folders are removed, false otherwise.
* @since 3.2.2
* @since 3.2.2
*/
protected function removeFolder(string $dir, ?array $ignore = null): bool
{
@ -335,7 +331,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param array $ignore The folders and files to ignore.
*
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
* @since 3.2.1
* @since 3.2.1
*/
protected function isDirEmpty(string $dir, array $ignore): bool
{
@ -355,7 +351,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Remove the files and folders in the given array from
*
* @return void
*
* @since 3.6
*/
protected function removeFiles()
@ -387,7 +382,6 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Moves the CLI scripts into the CLI folder in the CMS
*
* @return void
*
* @since 3.6
*/
protected function moveCliFiles()
@ -418,7 +412,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $contentHistoryOptions
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setContentType(
string $typeTitle,
@ -480,7 +474,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $textPrefix
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setActionLogConfig(
string $typeTitle,
@ -533,7 +527,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Set action logs extensions integration
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setActionLogsExtensions(): void
{
@ -574,7 +568,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $rules The component rules
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setAssetsRules(string $rules): void
{
@ -612,7 +606,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $params The component rules
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setExtensionsParams(string $params): void
{
@ -655,7 +649,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $dataType This datatype we will change the rules column to if it to small.
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setDatabaseAssetsRulesFix(int $accessWorseCase, string $dataType): void
{
@ -690,7 +684,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param bool $fields The switch to also remove related field data
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeViewData(string $context, bool $fields = false): void
{
@ -713,7 +707,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeContentTypes(string $context): void
{
@ -770,7 +764,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFields(string $context): void
{
@ -832,7 +826,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param array $ids The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFieldsValues(string $context, array $ids): void
{
@ -863,7 +857,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFieldsGroups(string $context): void
{
@ -918,7 +912,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeViewHistory(string $context): void
{
@ -950,7 +944,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param array $ids The type ids
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeUcmBase(array $ids): void
{
@ -983,7 +977,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeUcmContent(string $context): void
{
@ -1015,7 +1009,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeContentItemTagMap(string $context): void
{
@ -1050,7 +1044,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeActionLogConfig(string $context): void
{
@ -1080,7 +1074,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Remove Asset Table Integrated
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeAssetData(): void
{
@ -1108,7 +1102,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Remove action logs extensions integrated
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeActionLogsExtensions(): void
{
@ -1138,7 +1132,7 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* Remove remove database fix (if possible)
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeDatabaseAssetsRulesFix(): void
{
@ -1176,20 +1170,31 @@ class Com_###Component###InstallerScript implements InstallerScriptInterface
* @param string $className The fully qualified name of the class to check.
*
* @return bool True if the class exists or was successfully loaded, false otherwise.
* @since 4.0.1
* @since 4.0.1
*/
protected function classExists(string $className): bool
{
if (!class_exists($className, true))
if (class_exists($className, true))
{
###THREE_POWER_AUTOLOADER###
return true;
}
// Check again if the class now exists after requiring the autoloader
if (!class_exists($className, true))
// Autoloaders to check
$autoloaders = [###INSTALLER_POWER_AUTOLOADER_ARRAY###];
foreach ($autoloaders as $autoloader)
{
if (file_exists($autoloader))
{
return false;
require_once $autoloader;
if (class_exists($className, true))
{
return true;
}
}
}
return true;
return false;
}###INSTALLERMETHODS###
}

View File

@ -182,6 +182,13 @@
"newName": "[[[Component]]]InstallerScript.php",
"type": "file"
},
"INSTALLER_AUTOLOADER_CLASS.php": {
"naam": "INSTALLER_AUTOLOADER_CLASS.php",
"path": "c0mp0n3nt/",
"rename": "new",
"newName": "[[[Component]]]InstallerPowerloader.php",
"type": "file"
},
"SITE_DISPATCHER.php": {
"naam": "SITE_DISPATCHER.php",
"path": "c0mp0n3nt/site/src/Dispatcher",

File diff suppressed because one or more lines are too long

View File

@ -1467,7 +1467,10 @@ class Joomla_componentModel extends AdminModel
}
// make sure that the component code name is safe.
$data['name_code'] = ComponentCodeNameHelper::safe($data['name_code']);
if (!empty($data['system_name']) && UtilitiesStringHelper::check($data['system_name']))
{
$data['name_code'] = ComponentCodeNameHelper::safe($data['name_code']);
}
// Set the GUID if empty or not valid
if (empty($data['guid']) && $data['id'] > 0)

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="5.0" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>26th July, 2024</creationDate>
<creationDate>27th July, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>5.0.2-alpha2</version>
<version>5.0.2-alpha3</version>
<description><![CDATA[
<h1>Component Builder (v.5.0.2-alpha2)</h1>
<h1>Component Builder (v.5.0.2-alpha3)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.