Update 2024-07-27 21:59:50

This commit is contained in:
Robot 2024-07-27 22:00:02 +02:00
parent f002f739bd
commit 7ec399f12f
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
19 changed files with 2058 additions and 23 deletions

View File

@ -32,11 +32,13 @@ This repository contains an index (see below) of all the approved powers within
- **abstract class Factory** | [Details](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9) | [Code](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9/code.php) | [Settings](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9/settings.json) | SPK: `Super---2e5bf608_de5c_4b00_a20d_47c26aa350d9---Power`
- **abstract class Grep** | [Details](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b) | [Code](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b/code.php) | [Settings](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b/settings.json) | SPK: `Super---1401a167_0ce4_4f4a_afee_2d8b02ed339b---Power`
- **abstract class Model** | [Details](src/584747d1-3a86-453d-b7a3-a2219de8d777) | [Code](src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php) | [Settings](src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json) | SPK: `Super---584747d1_3a86_453d_b7a3_a2219de8d777---Power`
- **abstract class PHPConfigurationChecker** | [Details](src/900456a2-feb5-48b9-9f05-c5a032a32c59) | [Code](src/900456a2-feb5-48b9-9f05-c5a032a32c59/code.php) | [Settings](src/900456a2-feb5-48b9-9f05-c5a032a32c59/settings.json) | SPK: `Super---900456a2_feb5_48b9_9f05_c5a032a32c59---Power`
- **abstract class Registry** | [Details](src/7e822c03-1b20-41d1-9427-f5b8d5836af7) | [Code](src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.php) | [Settings](src/7e822c03-1b20-41d1-9427-f5b8d5836af7/settings.json) | SPK: `Super---7e822c03_1b20_41d1_9427_f5b8d5836af7---Power`
- **abstract class Schema** | [Details](src/f3c04c28-bce4-422e-be93-7d163e4e342b) | [Code](src/f3c04c28-bce4-422e-be93-7d163e4e342b/code.php) | [Settings](src/f3c04c28-bce4-422e-be93-7d163e4e342b/settings.json) | SPK: `Super---f3c04c28_bce4_422e_be93_7d163e4e342b---Power`
- **abstract class SchemaChecker** | [Details](src/5f0205fa-5c43-424a-af7d-abc943c17c8c) | [Code](src/5f0205fa-5c43-424a-af7d-abc943c17c8c/code.php) | [Settings](src/5f0205fa-5c43-424a-af7d-abc943c17c8c/settings.json) | SPK: `Super---5f0205fa_5c43_424a_af7d_abc943c17c8c---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder](#vdm-joomla-componentbuilder)
- **final class PHPConfigurationChecker** | [Details](src/4b2d6f28-346e-46ec-bf24-d470319cca2d) | [Code](src/4b2d6f28-346e-46ec-bf24-d470319cca2d/code.php) | [Settings](src/4b2d6f28-346e-46ec-bf24-d470319cca2d/settings.json) | SPK: `Super---4b2d6f28_346e_46ec_bf24_d470319cca2d---Power`
- **final class Table** | [Details](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8) | [Code](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php) | [Settings](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/settings.json) | SPK: `Super---bfd1d6d5_56c1_4fe9_9fee_1c5910e1f5d8---Power`
- **Namespace**: [VDM\Joomla\Data](#vdm-joomla-data)
@ -60,6 +62,7 @@ This repository contains an index (see below) of all the approved powers within
- **interface InsertInterface** | [Details](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48) | [Code](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php) | [Settings](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json) | SPK: `Super---ad12ca1c_d3ce_4e7f_88c5_c6c92bdedc48---Power`
- **interface LoadInterface** | [Details](src/2ad31f74-f579-499d-b98b-c4f54fd615dd) | [Code](src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php) | [Settings](src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json) | SPK: `Super---2ad31f74_f579_499d_b98b_c4f54fd615dd---Power`
- **interface ModelInterface** | [Details](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff) | [Code](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php) | [Settings](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json) | SPK: `Super---8aef58c1_3f70_4bd4_b9e4_3f29fcd41cff---Power`
- **interface PHPConfigurationCheckerInterface** | [Details](src/95c02df3-fe0a-405b-b506-b7a5b8605b66) | [Code](src/95c02df3-fe0a-405b-b506-b7a5b8605b66/code.php) | [Settings](src/95c02df3-fe0a-405b-b506-b7a5b8605b66/settings.json) | SPK: `Super---95c02df3_fe0a_405b_b506_b7a5b8605b66---Power`
- **interface Registryinterface** | [Details](src/64e291c2-11f1-423d-a44d-837cc12cc017) | [Code](src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php) | [Settings](src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json) | SPK: `Super---64e291c2_11f1_423d_a44d_837cc12cc017---Power`
- **interface SchemaCheckerInterface** | [Details](src/b6e9854c-3672-42ec-8843-26c24b4635bd) | [Code](src/b6e9854c-3672-42ec-8843-26c24b4635bd/code.php) | [Settings](src/b6e9854c-3672-42ec-8843-26c24b4635bd/settings.json) | SPK: `Super---b6e9854c_3672_42ec_8843_26c24b4635bd---Power`
- **interface SchemaInterface** | [Details](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa) | [Code](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/code.php) | [Settings](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/settings.json) | SPK: `Super---4dd11b9b_3c64_460b_aaa6_62ba467db7aa---Power`

View File

@ -0,0 +1,52 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class PHPConfigurationChecker (Details)
> namespace: **VDM\Joomla\Componentbuilder**
> extends: **ExtendingPHPConfigurationChecker**
```uml
@startuml
class PHPConfigurationChecker << (F,LightGreen) >> #RoyalBlue {
+ __construct($app = null)
}
note right of PHPConfigurationChecker::__construct
Constructor.
since: 5.0.2
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---4b2d6f28_346e_46ec_bf24_d470319cca2d---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,88 @@
<?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
*/
namespace VDM\Joomla\Componentbuilder;
use VDM\Joomla\Interfaces\PHPConfigurationCheckerInterface;
use VDM\Joomla\Abstraction\PHPConfigurationChecker as ExtendingPHPConfigurationChecker;
/**
* Componentbuilder PHP Configuration Checker
*
* @since 3.2.2
*/
final class PHPConfigurationChecker extends ExtendingPHPConfigurationChecker implements PHPConfigurationCheckerInterface
{
/**
* The upload max filesize value
*
* @var string
* @since 5.0.2
**/
protected string $upload_max_filesize = '128M';
/**
* The post max size value
*
* @var string
* @since 5.0.2
**/
protected string $post_max_size = '128M';
/**
* The max execution time value
*
* @var int
* @since 5.0.2
**/
protected int $max_execution_time = 60;
/**
* The max input vars value
*
* @var int
* @since 5.0.2
**/
protected int $max_input_vars = 7000;
/**
* The max input time value
*
* @var int
* @since 5.0.2
**/
protected int $max_input_time = 60;
/**
* The memory limit value
*
* @var string
* @since 5.0.2
**/
protected string $memory_limit = '256M';
/**
* Constructor.
*
* @since 5.0.2
*/
public function __construct($app = null)
{
parent::__construct($app);
// set the required PHP Configures
$this->set('environment.name', 'Componentbuilder environment');
$this->set('environment.wiki_url', 'git.vdm.dev/joomla/Component-Builder/wiki/PHP-Settings');
}
}

View File

@ -0,0 +1,61 @@
/**
* The upload max filesize value
*
* @var string
* @since 5.0.2
**/
protected string $upload_max_filesize = '[[[upload_max_filesize]]]';
/**
* The post max size value
*
* @var string
* @since 5.0.2
**/
protected string $post_max_size = '[[[post_max_size]]]';
/**
* The max execution time value
*
* @var int
* @since 5.0.2
**/
protected int $max_execution_time = [[[max_execution_time]]];
/**
* The max input vars value
*
* @var int
* @since 5.0.2
**/
protected int $max_input_vars = [[[max_input_vars]]];
/**
* The max input time value
*
* @var int
* @since 5.0.2
**/
protected int $max_input_time = [[[max_input_time]]];
/**
* The memory limit value
*
* @var string
* @since 5.0.2
**/
protected string $memory_limit = '[[[memory_limit]]]';
/**
* Constructor.
*
* @since 5.0.2
*/
public function __construct($app = null)
{
parent::__construct($app);
// set the required PHP Configures
$this->set('environment.name', '[[[Component]]] environment');
$this->set('environment.wiki_url', '[[[environment_wiki_url]]]');
}

View File

@ -0,0 +1,21 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "900456a2-feb5-48b9-9f05-c5a032a32c59",
"guid": "4b2d6f28-346e-46ec-bf24-d470319cca2d",
"implements": [
"95c02df3-fe0a-405b-b506-b7a5b8605b66"
],
"load_selection": null,
"name": "PHPConfigurationChecker",
"power_version": "1.0.0",
"system_name": "VDM.Component.PHPConfigurationChecker",
"type": "final class",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].PHPConfigurationChecker",
"description": "[[[Component]]] PHP Configuration Checker\r\n\r\n@since 3.2.2",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,69 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class PHPConfigurationChecker (Details)
> namespace: **VDM\Joomla\Abstraction**
> extends: **Registry**
```uml
@startuml
abstract PHPConfigurationChecker #Orange {
# $app
+ __construct($app = null)
+ run() : void
# convertToBytes(string $value) : int
}
note right of PHPConfigurationChecker::__construct
Constructor.
since: 5.0.2
end note
note right of PHPConfigurationChecker::run
Check that the required configurations are set for PHP
since: 5.0.2
return: void
end note
note right of PHPConfigurationChecker::convertToBytes
Helper function to convert PHP INI memory values to bytes
since: 5.0.2
return: int
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---900456a2_feb5_48b9_9f05_c5a032a32c59---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,214 @@
<?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
*/
namespace VDM\Joomla\Abstraction;
use Joomla\CMS\Factory;
use VDM\Joomla\Interfaces\PHPConfigurationCheckerInterface;
use VDM\Joomla\Abstraction\Registry;
/**
* PHP Configuration Checker
*
* @since 5.0.2
*/
abstract class PHPConfigurationChecker extends Registry implements PHPConfigurationCheckerInterface
{
/**
* The upload max filesize value
*
* @var string
* @since 5.0.2
**/
protected string $upload_max_filesize;
/**
* The post max size value
*
* @var string
* @since 5.0.2
**/
protected string $post_max_size;
/**
* The max execution time value
*
* @var int
* @since 5.0.2
**/
protected int $max_execution_time;
/**
* The max input vars value
*
* @var int
* @since 5.0.2
**/
protected int $max_input_vars;
/**
* The max input time value
*
* @var int
* @since 5.0.2
**/
protected int $max_input_time;
/**
* The memory limit value
*
* @var string
* @since 5.0.2
**/
protected string $memory_limit;
/**
* The registry array.
*
* @var array
* @since 5.0.2
**/
protected array $active = [
'php' => [
'upload_max_filesize' => [
'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' => [
'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' => [
'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' => [
'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' => [
'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' => [
'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.'
]
],
'environment' => [
'name' => 'extension environment',
'objective' => 'These settings are crucial for ensuring the successful installation and stable functionality of the extension.',
'wiki_name' => 'PHP Settings Wiki',
'wiki_url' => '#'
]
];
/**
* Application object.
*
* @since 5.0.2
**/
protected $app;
/**
* Constructor.
*
* @param $app The app object.
*
* @since 5.0.2
*/
public function __construct($app = null)
{
$this->app = $app ?: Factory::getApplication();
// set the required PHP Configures
$this->set('php.upload_max_filesize.value', $this->upload_max_filesize);
$this->set('php.post_max_size.value', $this->post_max_size);
$this->set('php.max_execution_time.value', $this->max_execution_time);
$this->set('php.max_input_vars.value', $this->max_input_vars);
$this->set('php.max_input_time.value', $this->max_input_time);
$this->set('php.memory_limit.value', $this->memory_limit);
}
/**
* Check that the required configurations are set for PHP
*
* @return void
* @since 5.0.2
**/
public function run(): void
{
$showHelp = false;
// Check each configuration and provide detailed feedback
$configurations = $this->active['php'] ?? [];
foreach ($configurations as $configName => $configDetails)
{
$currentValue = ini_get($configName);
if ($currentValue === false)
{
$this->app->enqueueMessage("Error: Unable to retrieve current setting for '{$configName}'.", 'error');
continue;
}
$requiredValue = $configDetails['value'] ?? 0;
$isMemoryValue = strpbrk($requiredValue, 'KMG') !== false;
$requiredValueBytes = $isMemoryValue ? $this->convertToBytes($requiredValue) : (int) $requiredValue;
$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 {$requiredValue} but is currently {$currentValue}. " . $configDetails['warning'] ?? '';
$showHelp = ($showHelp || $messageType === 'warning') ? true : false;
$this->app->enqueueMessage($messageText, $messageType);
}
if ($showHelp)
{
$this->app->enqueueMessage("To optimize your {$this->get('environment.name', 'extension')}, specific PHP settings must be enhanced.<br>{$this->get('environment.objective', '')}<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://{$this->get('environment.wiki_url', '#')}\" target=\"_blank\">{$this->get('environment.wiki_name', 'PHP Settings Wiki')}</a>.", 'notice');
}
}
/**
* Helper function to convert PHP INI memory values to bytes
*
* @param string $value The value to convert
*
* @return int The bytes value
* @since 5.0.2
*/
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;
}
}
}

View File

@ -0,0 +1,186 @@
/**
* The upload max filesize value
*
* @var string
* @since 5.0.2
**/
protected string $upload_max_filesize;
/**
* The post max size value
*
* @var string
* @since 5.0.2
**/
protected string $post_max_size;
/**
* The max execution time value
*
* @var int
* @since 5.0.2
**/
protected int $max_execution_time;
/**
* The max input vars value
*
* @var int
* @since 5.0.2
**/
protected int $max_input_vars;
/**
* The max input time value
*
* @var int
* @since 5.0.2
**/
protected int $max_input_time;
/**
* The memory limit value
*
* @var string
* @since 5.0.2
**/
protected string $memory_limit;
/**
* The registry array.
*
* @var array
* @since 5.0.2
**/
protected array $active = [
'php' => [
'upload_max_filesize' => [
'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' => [
'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' => [
'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' => [
'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' => [
'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' => [
'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.'
]
],
'environment' => [
'name' => 'extension environment',
'objective' => 'These settings are crucial for ensuring the successful installation and stable functionality of the extension.',
'wiki_name' => 'PHP Settings Wiki',
'wiki_url' => '#'
]
];
/**
* Application object.
*
* @since 5.0.2
**/
protected $app;
/**
* Constructor.
*
* @param $app The app object.
*
* @since 5.0.2
*/
public function __construct($app = null)
{
$this->app = $app ?: Factory::getApplication();
// set the required PHP Configures
$this->set('php.upload_max_filesize.value', $this->upload_max_filesize);
$this->set('php.post_max_size.value', $this->post_max_size);
$this->set('php.max_execution_time.value', $this->max_execution_time);
$this->set('php.max_input_vars.value', $this->max_input_vars);
$this->set('php.max_input_time.value', $this->max_input_time);
$this->set('php.memory_limit.value', $this->memory_limit);
}
/**
* Check that the required configurations are set for PHP
*
* @return void
* @since 5.0.2
**/
public function run(): void
{
$showHelp = false;
// Check each configuration and provide detailed feedback
$configurations = $this->active['php'] ?? [];
foreach ($configurations as $configName => $configDetails)
{
$currentValue = ini_get($configName);
if ($currentValue === false)
{
$this->app->enqueueMessage("Error: Unable to retrieve current setting for '{$configName}'.", 'error');
continue;
}
$requiredValue = $configDetails['value'] ?? 0;
$isMemoryValue = strpbrk($requiredValue, 'KMG') !== false;
$requiredValueBytes = $isMemoryValue ? $this->convertToBytes($requiredValue) : (int) $requiredValue;
$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 {$requiredValue} but is currently {$currentValue}. " . $configDetails['warning'] ?? '';
$showHelp = ($showHelp || $messageType === 'warning') ? true : false;
$this->app->enqueueMessage($messageText, $messageType);
}
if ($showHelp)
{
$this->app->enqueueMessage("To optimize your {$this->get('environment.name', 'extension')}, specific PHP settings must be enhanced.<br>{$this->get('environment.objective', '')}<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://{$this->get('environment.wiki_url', '#')}\" target=\"_blank\">{$this->get('environment.wiki_name', 'PHP Settings Wiki')}</a>.", 'notice');
}
}
/**
* Helper function to convert PHP INI memory values to bytes
*
* @param string $value The value to convert
*
* @return int The bytes value
* @since 5.0.2
*/
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;
}
}

View File

@ -0,0 +1,21 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "7e822c03-1b20-41d1-9427-f5b8d5836af7",
"guid": "900456a2-feb5-48b9-9f05-c5a032a32c59",
"implements": [
"95c02df3-fe0a-405b-b506-b7a5b8605b66"
],
"load_selection": null,
"name": "PHPConfigurationChecker",
"power_version": "1.0.0",
"system_name": "VDM.PHPConfigurationChecker",
"type": "abstract class",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.PHPConfigurationChecker",
"description": "PHP Configuration Checker\r\n\r\n@since 5.0.2",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\CMS\\Factory;",
"composer": ""
}

View File

@ -0,0 +1,52 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface PHPConfigurationCheckerInterface (Details)
> namespace: **VDM\Joomla\Interfaces**
```uml
@startuml
interface PHPConfigurationCheckerInterface #Lavender {
+ run() : void
}
note right of PHPConfigurationCheckerInterface::run
Check that the required configurations are set for PHP
since: 5.0.2
return: void
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---95c02df3_fe0a_405b_b506_b7a5b8605b66---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,30 @@
<?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
*/
namespace VDM\Joomla\Interfaces;
/**
* PHP Configuration Checker
*
* @since 5.0.2
*/
interface PHPConfigurationCheckerInterface
{
/**
* Check that the required configurations are set for PHP
*
* @return void
* @since 5.0.2
**/
public function run(): void;
}

View File

@ -0,0 +1,7 @@
/**
* Check that the required configurations are set for PHP
*
* @return void
* @since 5.0.2
**/
public function run(): void;

View File

@ -0,0 +1,19 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "95c02df3-fe0a-405b-b506-b7a5b8605b66",
"implements": null,
"load_selection": null,
"name": "PHPConfigurationCheckerInterface",
"power_version": "1.0.0",
"system_name": "VDM.PHPConfigurationCheckerInterface",
"type": "interface",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.PHPConfigurationCheckerInterface",
"description": "PHP Configuration Checker\r\n\r\n@since 5.0.2",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -9296,20 +9296,20 @@ final class Table extends BaseTable implements Tableinterface
'key' => false,
],
],
'not_required' => [
'name' => 'not_required',
'label' => '',
'type' => 'hidden',
'alias' => [
'name' => 'alias',
'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_ALIAS_LABEL',
'type' => 'text',
'title' => false,
'list' => 'help_documents',
'store' => NULL,
'tab_name' => 'Details',
'db' => [
'type' => 'INT(1)',
'default' => '0',
'type' => 'CHAR(64)',
'default' => '',
'null_switch' => 'NOT NULL',
'unique_key' => false,
'key' => false,
'key' => true,
],
],
'content' => [
@ -9376,22 +9376,6 @@ final class Table extends BaseTable implements Tableinterface
'key' => true,
],
],
'alias' => [
'name' => 'alias',
'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_ALIAS_LABEL',
'type' => 'text',
'title' => false,
'list' => 'help_documents',
'store' => NULL,
'tab_name' => 'Details',
'db' => [
'type' => 'CHAR(64)',
'default' => '',
'null_switch' => 'NOT NULL',
'unique_key' => false,
'key' => true,
],
],
],
'admin_fields' => [
'admin_view' => [

View File

@ -0,0 +1,58 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class MimeHelper (Details)
> namespace: **TrueChristianSermon\Joomla\Utilities**
```uml
@startuml
abstract MimeHelper #Orange {
+ {static} mimeType(string $file) : string
+ {static} getFileExtensions(string $target = null, boolean $sorted = false) : array
}
note right of MimeHelper::mimeType
Get the mime type based on file extension
return: string
end note
note right of MimeHelper::getFileExtensions
Get the file extensions
return: array
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---f11dc790_713e_4706_9a85_a318ed3ad56e---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
[EXTERNALCODE=https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/file-extension-to-mimetype.php]
[EXTERNALCODE=https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/get-mime-type.php]
[EXTERNALCODE=https://git.vdm.dev/joomla/jcb-external/raw/branch/master/src/get-file-extensions.php]

View File

@ -0,0 +1,19 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "f11dc790-713e-4706-9a85-a318ed3ad56e",
"implements": null,
"load_selection": null,
"name": "MimeHelper",
"power_version": "1.0.0",
"system_name": "Utilities MimeHelper",
"type": "abstract class",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.MimeHelper",
"description": "Mime Helper\r\n\r\n@since 3.0.11",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -307,6 +307,17 @@
"spk": "Super---4b225c51_d293_48e4_b3f6_5136cf5c3f18---Power",
"guid": "4b225c51-d293-48e4-b3f6-5136cf5c3f18"
},
"4b2d6f28-346e-46ec-bf24-d470319cca2d": {
"name": "PHPConfigurationChecker",
"type": "final class",
"namespace": "VDM\\Joomla\\Componentbuilder",
"code": "src\/4b2d6f28-346e-46ec-bf24-d470319cca2d\/code.php",
"power": "src\/4b2d6f28-346e-46ec-bf24-d470319cca2d\/code.power",
"settings": "src\/4b2d6f28-346e-46ec-bf24-d470319cca2d\/settings.json",
"path": "src\/4b2d6f28-346e-46ec-bf24-d470319cca2d",
"spk": "Super---4b2d6f28_346e_46ec_bf24_d470319cca2d---Power",
"guid": "4b2d6f28-346e-46ec-bf24-d470319cca2d"
},
"4dd11b9b-3c64-460b-aaa6-62ba467db7aa": {
"name": "SchemaInterface",
"type": "interface",
@ -560,6 +571,17 @@
"spk": "Super---8f83fb79_f92b_4f1f_952b_325f6c22d11e---Power",
"guid": "8f83fb79-f92b-4f1f-952b-325f6c22d11e"
},
"900456a2-feb5-48b9-9f05-c5a032a32c59": {
"name": "PHPConfigurationChecker",
"type": "abstract class",
"namespace": "VDM\\Joomla\\Abstraction",
"code": "src\/900456a2-feb5-48b9-9f05-c5a032a32c59\/code.php",
"power": "src\/900456a2-feb5-48b9-9f05-c5a032a32c59\/code.power",
"settings": "src\/900456a2-feb5-48b9-9f05-c5a032a32c59\/settings.json",
"path": "src\/900456a2-feb5-48b9-9f05-c5a032a32c59",
"spk": "Super---900456a2_feb5_48b9_9f05_c5a032a32c59---Power",
"guid": "900456a2-feb5-48b9-9f05-c5a032a32c59"
},
"91004529-94a9-4590-b842-e7c6b624ecf5": {
"name": "ObjectHelper",
"type": "abstract class",
@ -593,6 +615,17 @@
"spk": "Super---92291f1f_f248_4ec0_9f2a_3d47c49eeac1---Power",
"guid": "92291f1f-f248-4ec0-9f2a-3d47c49eeac1"
},
"95c02df3-fe0a-405b-b506-b7a5b8605b66": {
"name": "PHPConfigurationCheckerInterface",
"type": "interface",
"namespace": "VDM\\Joomla\\Interfaces",
"code": "src\/95c02df3-fe0a-405b-b506-b7a5b8605b66\/code.php",
"power": "src\/95c02df3-fe0a-405b-b506-b7a5b8605b66\/code.power",
"settings": "src\/95c02df3-fe0a-405b-b506-b7a5b8605b66\/settings.json",
"path": "src\/95c02df3-fe0a-405b-b506-b7a5b8605b66",
"spk": "Super---95c02df3_fe0a_405b_b506_b7a5b8605b66---Power",
"guid": "95c02df3-fe0a-405b-b506-b7a5b8605b66"
},
"9c3aa650-e536-4eea-a2d4-73cc3e184aa9": {
"name": "DeleteInterface",
"type": "interface",