Release of v3.1.3-alpha2

Improve the PHP environment setup validation. Add option to pass shared session via tag share.
This commit is contained in:
Robot 2024-07-29 18:16:32 +02:00
parent 615a7e0cef
commit 4f7059010d
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
26 changed files with 1479 additions and 201 deletions

View File

@ -1,11 +1,13 @@
# v3.1.3-alpha1
# v3.1.3-alpha2
- Improve the removeFolder method in the install script
- Improve the PHP environment setup validation
- Add option to pass shared session via tag share
# v3.1.3-alpha
- Refactored the API classes
- Add table schema checker
- Improve the removeFolder method in the install script
# v3.1.1

View File

@ -1,4 +1,4 @@
# Get Bible (3.1.3-alpha1)
# Get Bible (3.1.3-alpha2)
![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible")
@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Get Bible](https://getbible.net)
+ *First Build*: 3rd December, 2015
+ *Last Build*: 15th July, 2024
+ *Version*: 3.1.3-alpha1
+ *Last Build*: 29th July, 2024
+ *Version*: 3.1.3-alpha2
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**626 Hours** or **78 Eight Hour Days** (actual time the author saved -
**648 Hours** or **81 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **224160**
+ *File count*: **1896**
+ *Folder count*: **154**
+ *Line count*: **232257**
+ *File count*: **1944**
+ *Folder count*: **156**
**412 Hours** or **52 Eight Hour Days** (the actual time the author spent)
**427 Hours** or **53 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @156hours** = codingtime / 4;
> **planning @89hours** = codingtime / 7;
> **mapping @63hours** = codingtime / 10;
> **office @104hours** = codingtime / 6;)
> **debugging @162hours** = codingtime / 4;
> **planning @93hours** = codingtime / 7;
> **mapping @65hours** = codingtime / 10;
> **office @108hours** = codingtime / 6;)
**1038 Hours** or **130 Eight Hour Days**
**1075 Hours** or **134 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **26 weeks** or **5.4 months**
Project duration: **26.8 weeks** or **5.6 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -1,4 +1,4 @@
# Get Bible (3.1.3-alpha1)
# Get Bible (3.1.3-alpha2)
![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible")
@ -18,38 +18,38 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Get Bible](https://getbible.net)
+ *First Build*: 3rd December, 2015
+ *Last Build*: 15th July, 2024
+ *Version*: 3.1.3-alpha1
+ *Last Build*: 29th July, 2024
+ *Version*: 3.1.3-alpha2
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**626 Hours** or **78 Eight Hour Days** (actual time the author saved -
**648 Hours** or **81 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **224160**
+ *File count*: **1896**
+ *Folder count*: **154**
+ *Line count*: **232257**
+ *File count*: **1944**
+ *Folder count*: **156**
**412 Hours** or **52 Eight Hour Days** (the actual time the author spent)
**427 Hours** or **53 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @156hours** = codingtime / 4;
> **planning @89hours** = codingtime / 7;
> **mapping @63hours** = codingtime / 10;
> **office @104hours** = codingtime / 6;)
> **debugging @162hours** = codingtime / 4;
> **planning @93hours** = codingtime / 7;
> **mapping @65hours** = codingtime / 10;
> **office @108hours** = codingtime / 6;)
**1038 Hours** or **130 Eight Hour Days**
**1075 Hours** or **134 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **26 weeks** or **5.4 months**
Project duration: **26.8 weeks** or **5.6 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.10" method="upgrade">
<name>COM_GETBIBLE</name>
<creationDate>15th July, 2024</creationDate>
<creationDate>29th July, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://getbible.net</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>3.1.3-alpha1</version>
<version>3.1.3-alpha2</version>
<description><![CDATA[
<h1>Get Bible (v.3.1.3-alpha1)</h1>
<h1>Get Bible (v.3.1.3-alpha2)</h1>
<div style="clear: both;"></div>
<p>Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide.

View File

@ -15,6 +15,7 @@ namespace TrueChristianBible\Joomla\Gitea\Abstraction;
use TrueChristianBible\Joomla\Gitea\Utilities\Http;
use TrueChristianBible\Joomla\Gitea\Utilities\Uri;
use TrueChristianBible\Joomla\Gitea\Utilities\Response;
use TrueChristianBible\Joomla\Interfaces\Git\ApiInterface;
/**
@ -22,7 +23,7 @@ use TrueChristianBible\Joomla\Gitea\Utilities\Response;
*
* @since 3.2.0
*/
abstract class Api
abstract class Api implements ApiInterface
{
/**
* The Http class

View File

@ -12,6 +12,7 @@
namespace TrueChristianBible\Joomla\Gitea\Repository;
use TrueChristianBible\Joomla\Interfaces\Git\Repository\ContentsInterface;
use TrueChristianBible\Joomla\Gitea\Abstraction\Api;
@ -20,7 +21,7 @@ use TrueChristianBible\Joomla\Gitea\Abstraction\Api;
*
* @since 3.2.0
*/
class Contents extends Api
class Contents extends Api implements ContentsInterface
{
/**
* Get a file from a repository.
@ -349,16 +350,16 @@ class Contents extends Api
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string $message The commit message.
* @param string $branch The branch name (optional).
* @param string $sha The blob SHA of the file.
* @param string $authorName The author name (optional).
* @param string $authorEmail The author email (optional).
* @param string $committerName The committer name (optional).
* @param string $committerEmail The committer email (optional).
* @param string $authorDate The author date (optional).
* @param string $committerDate The committer date (optional).
* @param string $newBranch The new branch name (optional).
* @param bool $signoff Add a Signed-off-by trailer (optional).
* @param string|null $branch The branch name (optional).
* @param string|null $authorName The author name (optional).
* @param string|null $authorEmail The author email (optional).
* @param string|null $committerName The committer name (optional).
* @param string|null $committerEmail The committer email (optional).
* @param string|null $authorDate The author date (optional).
* @param string|null $committerDate The committer date (optional).
* @param string|null $newBranch The new branch name (optional).
* @param bool|null $signoff Add a Signed-off-by trailer (optional).
*
* @return object|null
* @since 3.2.0
@ -449,7 +450,7 @@ class Contents extends Api
// Send the delete request.
return $this->response->get(
$this->http->delete(
$this->uri->get($path),
$this->uri->get($path), [], null,
json_encode($data)
)
);
@ -461,7 +462,7 @@ class Contents extends Api
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string $ref The name of the commit/branch/tag.
* @param string|null $ref The name of the commit/branch/tag.
*
* @return string|null
* @since 3.2.0

View File

@ -13,9 +13,11 @@ namespace TrueChristianBible\Joomla\Gitea\Utilities;
use Joomla\CMS\Http\Http as JoomlaHttp;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
/**
* The Gitea Http
*

View File

@ -0,0 +1,305 @@
<?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 TrueChristianBible\Joomla\Abstraction;
use TrueChristianBible\Joomla\Interfaces\Activeregistryinterface;
/**
* Active Storage Registry.
*
* Don't use this beyond 10 dimensional depth for best performance.
*
* @since 3.2.0
*/
abstract class ActiveRegistry implements Activeregistryinterface
{
/**
* The registry array.
*
* @var array
* @since 3.2.0
**/
protected array $active = [];
/**
* Base switch to add values as string or array
*
* @var boolean
* @since 3.2.0
**/
protected bool $addAsArray = false;
/**
* Base switch to keep array values unique
*
* @var boolean
* @since 3.2.2
**/
protected bool $uniqueArray = false;
/**
* Check if the registry has any content.
*
* @return bool Returns true if the active array is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive(): bool
{
return !empty($this->active);
}
/**
* Get all value from the active registry.
*
* @return array The values or empty array.
* @since 3.2.0
*/
public function allActive(): array
{
return $this->active;
}
/**
* Sets a value into the registry using multiple keys.
*
* @param mixed $value The value to set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function setActive($value, string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to set any value.");
}
$array = &$this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
if (!is_array($array))
{
$path = '[' . implode('][', $keys) . ']';
throw new \InvalidArgumentException("Attempted to use key '{$key}' on a non-array value: {$array}. Path: {$path} Value: {$value}");
}
$array[$key] = [];
}
$array = &$array[$key];
}
$array = $value;
}
/**
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, ?bool $asArray, string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to add any value.");
}
// null fallback to class value
if ($asArray === null)
{
$asArray = $this->addAsArray;
}
$array = &$this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
if (!is_array($array))
{
$path = '[' . implode('][', $keys) . ']';
throw new \InvalidArgumentException("Attempted to use key '{$key}' on a non-array value: {$array}. Path: {$path} Value: {$value}");
}
$array[$key] = [];
}
$array = &$array[$key];
}
// add string
if (!$asArray && $array === [])
{
$array = '';
}
// Handle the adding logic at the tip of the array
if (is_array($array) || $asArray)
{
if (!is_array($array))
{
// Convert to array if it's not already an array
$array = [$array];
}
if ($this->uniqueArray && in_array($value, $array))
{
// we do nothing
return;
}
else
{
$array[] = $value;
}
}
else
{
if (is_string($value) || is_numeric($value))
{
$array .= (string) $value;
}
else
{
$array = $value;
}
}
}
/**
* Retrieves a value (or sub-array) from the registry using multiple keys.
*
* @param mixed $default The default value if not set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function getActive($default, string ...$keys)
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to get any value.");
}
$array = $this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return $default;
}
$array = $array[$key];
}
return $array;
}
/**
* Removes a value (or sub-array) from the registry using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function removeActive(string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to remove any value.");
}
$array = &$this->active;
$lastKey = array_pop($keys);
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return; // Exit early if the key doesn't exist
}
$array = &$array[$key];
}
unset($array[$lastKey]);
}
/**
* Checks the existence of a particular location in the registry using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function existsActive(string ...$keys): bool
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to check if any value exist.");
}
$array = $this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return false;
}
$array = $array[$key];
}
return true;
}
/**
* Checks that the keys are valid
*
* @param array $keys The keys to determine the location.
*
* @return bool False if any of the keys are not a number or string.
* @since 3.2.0
*/
protected function validActiveKeys(array $keys): bool
{
foreach ($keys as $key)
{
if ($key === '' || (!is_string($key) && !is_numeric($key)))
{
return false;
}
}
return true;
}
}

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 TrueChristianBible\Joomla\Abstraction;
use Joomla\CMS\Factory;
use TrueChristianBible\Joomla\Interfaces\PHPConfigurationCheckerInterface;
use TrueChristianBible\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,191 @@
<?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 TrueChristianBible\Joomla\Abstraction;
use TrueChristianBible\Joomla\Interfaces\Registryinterface;
use TrueChristianBible\Joomla\Abstraction\ActiveRegistry;
/**
* VDM Basic Registry.
*
* Don't use this beyond 10 dimensional depth for best performance.
*
* @since 3.2.0
*/
abstract class Registry extends ActiveRegistry implements Registryinterface
{
/**
* Path separator
*
* @var string|null
* @since 3.2.0
*/
protected ?string $separator = '.';
/**
* Sets a value into the registry using multiple keys.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
*/
public function set(string $path, $value): self
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to set any value.");
}
$this->setActive($value, ...$keys);
return $this;
}
/**
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to add any value.");
}
$this->addActive($value, $asArray, ...$keys);
return $this;
}
/**
* Retrieves a value (or sub-array) from the registry using multiple keys.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $default Optional default value, returned if the internal doesn't exist.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function get(string $path, $default = null)
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to get any value.");
}
return $this->getActive($default, ...$keys);
}
/**
* Removes a value (or sub-array) from the registry using multiple keys.
*
* @param string $path Registry path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
*/
public function remove(string $path): self
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to remove any value.");
}
$this->removeActive(...$keys);
return $this;
}
/**
* Checks the existence of a particular location in the registry using multiple keys.
*
* @param string $path Registry path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function exists(string $path): bool
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to check if any value exist.");
}
return $this->existsActive(...$keys);
}
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return self
* @since 3.2.0
*/
public function setSeparator(?string $value): self
{
$this->separator = $value;
return $this;
}
/**
* Get that the active keys from a path
*
* @param string $path The path to determine the location registry.
*
* @return array|null The valid array of keys
* @since 3.2.0
*/
protected function getActiveKeys(string $path): ?array
{
// empty path no allowed
if ($path === '')
{
return null;
}
// Flatten the path
if ($this->separator === null || $this->separator === '')
{
return [$path];
}
$keys = array_values(array_filter(explode($this->separator, $path), 'strlen'));
if (empty($keys))
{
return null;
}
return $keys;
}
}

View File

@ -455,8 +455,8 @@ abstract class Schema implements SchemaInterface
return true;
}
if (is_string($expected['default']) && strtoupper($expected['default']) === 'EMPTY' &&
is_string($current->Default) && strpos($current->Default, 'EMPTY') !== false)
if (isset($expected['default']) && is_string($expected['default']) && strtoupper($expected['default']) === 'EMPTY' &&
isset($current->Default) && is_string($current->Default) && strpos($current->Default, 'EMPTY') !== false)
{
return true; // little fix
}

View File

@ -13,7 +13,6 @@ namespace TrueChristianBible\Joomla\Abstraction;
use Joomla\CMS\Factory;
use Joomla\CMS\Application\CMSApplication;
use TrueChristianBible\Joomla\Interfaces\SchemaInterface as Schema;
use TrueChristianBible\Joomla\Interfaces\Tableinterface as Table;
use TrueChristianBible\Joomla\Utilities\ClassHelper;
@ -46,22 +45,21 @@ abstract class SchemaChecker implements SchemaCheckerInterface
/**
* Application object.
*
* @var CMSApplication
* @since 3.2.2
**/
protected CMSApplication $app;
protected $app;
/**
* Constructor.
*
* @param Schema|null $schema The Schema Class.
* @param Table|null $table The Table Class.
* @param CMSApplication|null $app The app object.
* @param $app The app object.
*
* @throws \Exception
* @since 3.2.2
*/
public function __construct(?Schema $schema = null, ?Table $table = null, ?CMSApplication $app = null)
public function __construct(?Schema $schema = null, ?Table $table = null, $app = null)
{
$this->schema = $schema;
$this->table = $table;

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 TrueChristianBible\Joomla\GetBible;
use TrueChristianBible\Joomla\Interfaces\PHPConfigurationCheckerInterface;
use TrueChristianBible\Joomla\Abstraction\PHPConfigurationChecker as ExtendingPHPConfigurationChecker;
/**
* Getbible PHP Configuration Checker
*
* @since 5.02
*/
final class PHPConfigurationChecker extends ExtendingPHPConfigurationChecker implements PHPConfigurationCheckerInterface
{
/**
* The upload max filesize value
*
* @var string
* @since 5.0.2
**/
protected string $upload_max_filesize = '64M';
/**
* 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 = 5000;
/**
* 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', 'Getbible environment');
$this->set('environment.wiki_url', 'git.vdm.dev/getBible/support/wiki/PHP-Settings');
}
}

View File

@ -0,0 +1,100 @@
<?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 TrueChristianBible\Joomla\Interfaces;
/**
* The Active Registry Interface
*
* @since 3.2.0
*/
interface Activeregistryinterface
{
/**
* Check if the registry has any content.
*
* @return bool Returns true if the active array is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive(): bool;
/**
* Retrieves all value from the registry.
*
* @return array The values.
* @since 3.2.0
*/
public function allActive(): array;
/**
* Sets a value into the registry using multiple keys.
*
* @param mixed $value The value to set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function setActive($value, string ...$keys): void;
/**
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, ?bool $asArray, string ...$keys): void;
/**
* Retrieves a value (or sub-array) from the registry using multiple keys.
*
* @param mixed $default The default value if not set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function getActive($default, string ...$keys);
/**
* Removes a value (or sub-array) from the registry using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function removeActive(string ...$keys): void;
/**
* Checks the existence of a particular location in the registry using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function existsActive(string ...$keys): bool;
}

View File

@ -0,0 +1,50 @@
<?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 TrueChristianBible\Joomla\Interfaces\Git;
/**
* The Git Api Interface
*
* @since 3.2.0
*/
interface ApiInterface
{
/**
* Load/Reload API.
*
* @param string|null $url The url.
* @param token|null $token The token.
* @param bool $backup The backup swapping switch.
*
* @return void
* @since 3.2.0
**/
public function load_(?string $url = null, ?string $token = null, bool $backup = true): void;
/**
* Reset to previous toke, url it set
*
* @return void
* @since 3.2.0
**/
public function reset_(): void;
/**
* Get the API url
*
* @return string
* @since 3.2.0
**/
public function api();
}

View File

@ -0,0 +1,209 @@
<?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 TrueChristianBible\Joomla\Interfaces\Git\Repository;
use TrueChristianBible\Joomla\Interfaces\Git\ApiInterface;
/**
* The Git Repository Contents Interface
*
* @since 3.2.2
*/
interface ContentsInterface extends ApiInterface
{
/**
* Get a file from a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string|null $ref Optional. The name of the commit/branch/tag.
* Default the repository's default branch (usually master).
*
* @return mixed
* @since 3.2.0
**/
public function get(string $owner, string $repo, string $filepath, ?string $ref = null);
/**
* Get the metadata and contents (if a file) of an entry in a repository,
* or a list of entries if a directory.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file or directory path.
* @param string|null $ref Optional. The name of the commit/branch/tag.
* Default the repository's default branch (usually master).
*
* @return null|array|object
* @since 3.2.0
**/
public function metadata(string $owner, string $repo, string $filepath, ?string $ref = null): null|array|object;
/**
* Create a file in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string $content The file content.
* @param string $message The commit message.
* @param string $branch The branch name. Defaults to the repository's default branch.
* @param string|null $authorName The author's name.
* @param string|null $authorEmail The author's email.
* @param string|null $committerName The committer's name.
* @param string|null $committerEmail The committer's email.
* @param string|null $newBranch Whether to create a new branch. Defaults to null.
* @param string|null $authorDate The author's date.
* @param string|null $committerDate The committer's date.
* @param bool|null $signoff Add a Signed-off-by trailer. Defaults to null.
*
* @return object|null
* @since 3.2.0
**/
public function create(
string $owner,
string $repo,
string $filepath,
string $content,
string $message,
string $branch = 'master',
?string $authorName = null,
?string $authorEmail = null,
?string $committerName = null,
?string $committerEmail = null,
?string $newBranch = null,
?string $authorDate = null,
?string $committerDate = null,
?bool $signoff = null
): ?object;
/**
* Get the metadata of all the entries of the root directory.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string|null $ref The name of the commit/branch/tag. Default the repository's default branch (usually master).
*
* @return array|null
* @since 3.2.0
**/
public function root(string $owner, string $repo, ?string $ref = null): ?array;
/**
* Update a file in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string $content The file content.
* @param string $message The commit message.
* @param string $sha The blob SHA of the file.
* @param string $branch The branch name. Defaults to the repository's default branch.
* @param string|null $authorName The author name. Defaults to the authenticated user.
* @param string|null $authorEmail The author email. Defaults to the authenticated user.
* @param string|null $committerName The committer name. Defaults to the authenticated user.
* @param string|null $committerEmail The committer email. Defaults to the authenticated user.
* @param string|null $authorDate The author date.
* @param string|null $committerDate The committer date.
* @param string|null $fromPath The original file path to move/rename.
* @param string|null $newBranch The new branch to create from the specified branch.
* @param bool|null $signoff Add a Signed-off-by trailer.
*
* @return object|null
* @since 3.2.0
**/
public function update(
string $owner,
string $repo,
string $filepath,
string $content,
string $message,
string $sha,
string $branch = 'master',
?string $authorName = null,
?string $authorEmail = null,
?string $committerName = null,
?string $committerEmail = null,
?string $authorDate = null,
?string $committerDate = null,
?string $fromPath = null,
?string $newBranch = null,
?bool $signoff = null
): ?object;
/**
* Delete a file in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string $message The commit message.
* @param string $sha The blob SHA of the file.
* @param string|null $branch The branch name (optional).
* @param string|null $authorName The author name (optional).
* @param string|null $authorEmail The author email (optional).
* @param string|null $committerName The committer name (optional).
* @param string|null $committerEmail The committer email (optional).
* @param string|null $authorDate The author date (optional).
* @param string|null $committerDate The committer date (optional).
* @param string|null $newBranch The new branch name (optional).
* @param bool|null $signoff Add a Signed-off-by trailer (optional).
*
* @return object|null
* @since 3.2.0
**/
public function delete(
string $owner,
string $repo,
string $filepath,
string $message,
string $sha,
?string $branch = null,
?string $authorName = null,
?string $authorEmail = null,
?string $committerName = null,
?string $committerEmail = null,
?string $authorDate = null,
?string $committerDate = null,
?string $newBranch = null,
?bool $signoff = null
): ?object;
/**
* Get the EditorConfig definitions of a file in a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string|null $ref The name of the commit/branch/tag.
*
* @return string|null
* @since 3.2.0
**/
public function editor(string $owner, string $repo, string $filepath, string $ref = null): ?string;
/**
* Get the blob of a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $sha The SHA hash of the blob.
*
* @return object|null
* @since 3.2.0
**/
public function blob(string $owner, string $repo, string $sha): ?object;
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

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 TrueChristianBible\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,97 @@
<?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 TrueChristianBible\Joomla\Interfaces;
use TrueChristianBible\Joomla\Interfaces\Activeregistryinterface;
/**
* The Registry Interface
*
* @since 3.2.0
*/
interface Registryinterface extends Activeregistryinterface
{
/**
* Sets a value into the registry using multiple keys.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
*/
public function set(string $path, $value): self;
/**
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self;
/**
* Retrieves a value (or sub-array) from the registry using multiple keys.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $default Optional default value, returned if the internal doesn't exist.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function get(string $path, $default = null);
/**
* Removes a value (or sub-array) from the registry using multiple keys.
*
* @param string $path Registry path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
*/
public function remove(string $path): self;
/**
* Checks the existence of a particular location in the registry using multiple keys.
*
* @param string $path Registry path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function exists(string $path): bool;
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return self
* @since 3.2.0
*/
public function setSeparator(?string $value): self;
}

View File

@ -45,8 +45,8 @@ final class Load extends Model implements ModelInterface
$table = $this->getTable();
}
// check if this is a valid table
if (($store = $this->table->get($table, $field, 'store')) !== null)
// check if this is a valid table (don't touch null)
if ($value !== null && ($store = $this->table->get($table, $field, 'store')) !== null)
{
// open the value based on the store method
switch($store)

View File

@ -25,11 +25,14 @@ use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper as Html;
use TrueChristianBible\Joomla\GetBible\PHPConfigurationChecker;
use TrueChristianBible\Joomla\GetBible\Table\SchemaChecker;
HTML::_('bootstrap.renderModal');
/**
* Script File of Getbible Component
*
* @since 1.5.0
*/
class Com_GetbibleInstallerScript
{
@ -37,6 +40,7 @@ class Com_GetbibleInstallerScript
* Constructor
*
* @param ComponentAdapter $parent The object responsible for running this script
* @since 1.5.0
*/
public function __construct(ComponentAdapter $parent) {}
@ -46,6 +50,7 @@ class Com_GetbibleInstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function install(ComponentAdapter $parent) {}
@ -53,6 +58,8 @@ class Com_GetbibleInstallerScript
* Called on uninstallation
*
* @param ComponentAdapter $parent The object responsible for running this script
*
* @since 1.5.0
*/
public function uninstall(ComponentAdapter $parent)
{
@ -957,6 +964,7 @@ class Com_GetbibleInstallerScript
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
* @since 1.5.0
*/
public function update(ComponentAdapter $parent){}
@ -967,6 +975,7 @@ class Com_GetbibleInstallerScript
* @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)
{
@ -1000,8 +1009,11 @@ class Com_GetbibleInstallerScript
return false;
}
// Check that the required configuration are set for PHP
$this->phpConfigurationCheck($app);
// Check that the PHP configurations are sufficient
if ($this->classExists(PHPConfigurationChecker::class))
{
(new PHPConfigurationChecker())->run();
}
// all things to clear out
$removeFolders = [];
@ -1021,8 +1033,11 @@ class Com_GetbibleInstallerScript
if ($type === 'install')
{
// Check that the required configuration are set for PHP
$this->phpConfigurationCheck($app);
// Check that the PHP configurations are sufficient
if ($this->classExists(PHPConfigurationChecker::class))
{
(new PHPConfigurationChecker())->run();
}
}
// check if the PHPExcel stuff is still around
if (File::exists(JPATH_ADMINISTRATOR . '/components/com_getbible/helpers/PHPExcel.php'))
@ -1042,6 +1057,7 @@ class Com_GetbibleInstallerScript
* @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)
{
@ -1581,7 +1597,7 @@ class Com_GetbibleInstallerScript
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://getbible.net" title="Get Bible">
<img src="components/com_getbible/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 3.1.3-alpha1 Was Successful! Let us know if anything is not working as expected.</h3></div>';
<h3>Upgrade to Version 3.1.3-alpha2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
// Set db if not set already.
if (!isset($db))
@ -2028,7 +2044,7 @@ class Com_GetbibleInstallerScript
*/
protected function removeFolder(string $dir, ?array $ignore = null): bool
{
if (!Folder::exists($dir))
if (!is_dir($dir))
{
return false;
}
@ -2131,130 +2147,31 @@ class Com_GetbibleInstallerScript
*/
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_getbible/helpers/powerloader.php';
if (file_exists($power_autoloader))
{
require_once $power_autoloader;
}
// Check again if the class now exists after requiring the autoloader
if (!class_exists($className, true))
{
return false;
}
}
return true;
}
/**
* Define the required limits with specific messages for success and warning scenarios
*
* @var array
* @since 3.0.8
*/
protected array $requiredPHPConfigs = [
'upload_max_filesize' => [
'value' => '64M',
'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' => 5000,
'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.'
]
// Autoloaders to check
$autoloaders = [
__DIR__ . '/script_powerloader.php',
JPATH_ADMINISTRATOR . '/components/com_getbible/helpers/powerloader.php'
];
/**
* Helper function to convert PHP INI memory values to bytes
*
* @param string $value The value to convert
*
* @return int The bytes value
* @since 3.0.8
*/
protected function convertToBytes(string $value): int
foreach ($autoloaders as $autoloader)
{
$value = trim($value);
$lastChar = strtolower($value[strlen($value) - 1]);
$numValue = substr($value, 0, -1);
if (file_exists($autoloader))
{
require_once $autoloader;
switch ($lastChar)
if (class_exists($className, true))
{
case 'g':
return $numValue * 1024 * 1024 * 1024;
case 'm':
return $numValue * 1024 * 1024;
case 'k':
return $numValue * 1024;
default:
return (int) $value;
return true;
}
}
}
/**
* Check that the required configurations are set for PHP
*
* @param $app The application
*
* @return void
* @since 3.0.8
*/
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 Get Bible environment, specific PHP settings must be enhanced.<br>These settings are crucial for ensuring the successful installation and stable functionality of the extension.<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/getBible/support/wiki/PHP-Settings" target="_blank">Get Bible PHP Settings Wiki</a>.
', 'notice');
}
return false;
}
/**

64
script_powerloader.php Normal file
View File

@ -0,0 +1,64 @@
<?php
/*----------------------------------------------------------------------------------| io.vdm.dev |----/
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@package getBible.net
@created 3rd December, 2015
@author Llewellyn van der Merwe <https://getbible.net>
@git Get Bible <https://git.vdm.dev/getBible>
@github Get Bible <https://github.com/getBible>
@support Get Bible <https://git.vdm.dev/getBible/support>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
/------------------------------------------------------------------------------------------------------*/
// 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_getbible/TrueChristianBible.Joomla.Openai' => 'TrueChristianBible\\Joomla\\Openai',
'libraries/vendor_getbible/TrueChristianBible.Joomla.Gitea' => 'TrueChristianBible\\Joomla\\Gitea',
'libraries/vendor_getbible/TrueChristianBible.Joomla' => 'TrueChristianBible\\Joomla'
];
// 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

@ -85,7 +85,7 @@ class GetbibleController extends BaseController
if (StringHelper::check($view))
{
$views = array(
''
);
// check if this is a edit view
if (in_array($view,$views))

View File

@ -26,11 +26,11 @@ use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Helper\TagsHelper;
use TrueChristianBible\Joomla\Utilities\StringHelper;
use TrueChristianBible\Joomla\GetBible\Factory as GetBibleFactory;
use TrueChristianBible\Joomla\Utilities\Component\Helper;
use TrueChristianBible\Joomla\Utilities\GuidHelper;
use TrueChristianBible\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use TrueChristianBible\Joomla\Utilities\JsonHelper;
use TrueChristianBible\Joomla\GetBible\Factory as GetBibleFactory;
/**
* Getbible List Model for Tag
@ -163,6 +163,13 @@ class GetbibleModelTag extends ListModel
$this->input ??= Factory::getApplication()->input;
// we add a Share_His_Word option to set the session key
if (($linker = $this->input->getString('Share_His_Word', null)) !== null
&& GetBibleFactory::_('GetBible.Linker')->valid($linker))
{
GetBibleFactory::_('GetBible.Linker')->trigger($linker);
}
$this->translation = $this->input->getString('t') ?? $this->input->getString('translation', Helper::getParams('com_getbible')->get('default_translation', 'kjv')) ;
$this->tag = $this->input->getString('guid') ?? '';

View File

@ -764,7 +764,7 @@
<version>3.1.3-alpha</version>
<infourl title="Get Bible!">https://getbible.net</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.3-alpha1.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.3-alpha2.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
@ -779,10 +779,10 @@
<element>pkg_getbible</element>
<type>package</type>
<client>site</client>
<version>3.1.3-alpha1</version>
<version>3.1.3-alpha2</version>
<infourl title="Get Bible!">https://getbible.net</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.3-alpha1.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.1.3-alpha2.zip</downloadurl>
</downloads>
<tags>
<tag>alpha</tag>