diff --git a/CHANGELOG.md b/CHANGELOG.md index c4804cc..d002be3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v4.0.12 + +- Add PHP check on installation. +- Add Database check on installation. + # v4.0.11 - Moved all library classes away from default Namespace and Folder path to avoid collusion on outdated classes. @@ -49,6 +54,7 @@ - Moved to Joomla 4 -# v3.0.8 +# v3.0.9 -- Moved all library classes away from default Namespace and Folder path to avoid collusion on outdated classes. \ No newline at end of file +- Add PHP check on installation. +- Add Database check on installation. \ No newline at end of file diff --git a/GetbibleInstallerScript.php b/GetbibleInstallerScript.php index 76d12b4..aa2bd21 100644 --- a/GetbibleInstallerScript.php +++ b/GetbibleInstallerScript.php @@ -26,6 +26,7 @@ use Joomla\CMS\Version; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\Filesystem\Folder; use Joomla\Database\DatabaseInterface; +use TrueChristianChurch\Joomla\GetBible\Table\Schema; // No direct access to this file defined('_JEXEC') or die; @@ -302,6 +303,9 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface // do any updates needed if ($type === 'update') { + + // Check that the required configuration are set for PHP + $this->phpConfigurationCheck($this->app); } // do any install needed @@ -310,7 +314,7 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface // all things to clear out $remove = JPATH_LIBRARIES . '/jcb_powers/VDM.Joomla.GetBible'; - if (Folder::exists($remove)) + if (is_dir($remove)) { $it = new \RecursiveDirectoryIterator($remove, \RecursiveDirectoryIterator::SKIP_DOTS); $files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); @@ -331,7 +335,10 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface // Delete the root folder Folder::delete($remove); - } + } + + // Check that the required configuration are set for PHP + $this->phpConfigurationCheck($this->app); } return true; @@ -468,6 +475,10 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface ); + + // Check that the database is up-to date + $this->databaseSchemaCheck($this->app); + echo '
'; @@ -777,10 +788,14 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface + + // Check that the database is up-to date + $this->databaseSchemaCheck($this->app); + echo '
-

Upgrade to Version 4.0.11 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 4.0.12 Was Successful! Let us know if anything is not working as expected.

'; // Add/Update component in the action logs extensions table. $this->setActionLogsExtensions(); @@ -1805,6 +1820,174 @@ class Com_GetbibleInstallerScript implements InstallerScriptInterface } } + /** + * 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.' + ] + ]; + + /** + * 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 + { + $value = trim($value); + $lastChar = strtolower($value[strlen($value) - 1]); + $numValue = substr($value, 0, -1); + + switch ($lastChar) + { + case 'g': + return $numValue * 1024 * 1024 * 1024; + case 'm': + return $numValue * 1024 * 1024; + case 'k': + return $numValue * 1024; + default: + return (int) $value; + } + } + + /** + * Check that the required configurations are set for PHP + * + * @param $app The application + * + * @return void + * @since 3.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.
These settings are crucial for ensuring the successful installation and stable functionality of the extension.
We\'ve identified that certain configurations currently do not meet the recommended standards.
To adjust these settings and prevent potential issues, please consult our detailed guide available at Get Bible PHP Settings Wiki. +', 'notice'); + } + } + + /** + * Make sure that the getbible database schema is up to date. + * + * @return void + * @since 3.0.8 + */ + protected function databaseSchemaCheck($app): void + { + // try to load the schema class + try + { + // make sure the class is loaded + $this->ensureClassExists( + Schema::class + ); + + // instantiate the schema class and check/update the database + $messages = (new Schema())->update(); + } + catch (\Exception $e) + { + $app->enqueueMessage($e->getMessage(), 'warning'); + return; + } + + foreach ($messages as $message) + { + $app->enqueueMessage($message, 'message'); + } + } + + /** + * Ensures that a class in the namespace is available. + * If the class is not already loaded, it attempts to load it via the power autoloader. + * + * @param mixed $nameClass The name::class we are looking for. + * + * @return void + * @since 3.0.8 + * @throws \Exception If the class could not be loaded. + */ + protected function ensureClassExists($nameClass): void + { + if (!class_exists($nameClass, true)) + { + // The power autoloader for this project admin area. + $power_autoloader = JPATH_ADMINISTRATOR . '/components/com_getbible/src/Helper/PowerloaderHelper.php'; + if (file_exists($power_autoloader)) + { + require_once $power_autoloader; + } + + // Check again if the class now exists after requiring it + if (!class_exists($nameClass, true)) + { + throw new \Exception("We failed to find/load the $nameClass"); + } + } + } + /** * Method to move folders into place. * diff --git a/README.md b/README.md index 5487924..1483ae5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (4.0.11) +# Get Bible (4.0.12) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/5.0/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*: 6th April, 2024 -+ *Version*: 4.0.11 ++ *Last Build*: 27th April, 2024 ++ *Version*: 4.0.12 + *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 -**573 Hours** or **72 Eight Hour Days** (actual time the author saved - +**588 Hours** or **74 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*: **205473** -+ *File count*: **1698** ++ *Line count*: **210790** ++ *File count*: **1716** + *Folder count*: **174** -**379 Hours** or **47 Eight Hour Days** (the actual time the author spent) +**388 Hours** or **48 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @143hours** = codingtime / 4; -> **planning @82hours** = codingtime / 7; -> **mapping @57hours** = codingtime / 10; -> **office @96hours** = codingtime / 6;) +> **debugging @147hours** = codingtime / 4; +> **planning @84hours** = codingtime / 7; +> **mapping @59hours** = codingtime / 10; +> **office @98hours** = codingtime / 6;) -**952 Hours** or **119 Eight Hour Days** +**976 Hours** or **122 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: **23.8 weeks** or **5 months** +Project duration: **24.4 weeks** or **5.1 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) diff --git a/admin/README.txt b/admin/README.txt index 5487924..1483ae5 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (4.0.11) +# Get Bible (4.0.12) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/5.0/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*: 6th April, 2024 -+ *Version*: 4.0.11 ++ *Last Build*: 27th April, 2024 ++ *Version*: 4.0.12 + *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 -**573 Hours** or **72 Eight Hour Days** (actual time the author saved - +**588 Hours** or **74 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*: **205473** -+ *File count*: **1698** ++ *Line count*: **210790** ++ *File count*: **1716** + *Folder count*: **174** -**379 Hours** or **47 Eight Hour Days** (the actual time the author spent) +**388 Hours** or **48 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @143hours** = codingtime / 4; -> **planning @82hours** = codingtime / 7; -> **mapping @57hours** = codingtime / 10; -> **office @96hours** = codingtime / 6;) +> **debugging @147hours** = codingtime / 4; +> **planning @84hours** = codingtime / 7; +> **mapping @59hours** = codingtime / 10; +> **office @98hours** = codingtime / 6;) -**952 Hours** or **119 Eight Hour Days** +**976 Hours** or **122 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: **23.8 weeks** or **5 months** +Project duration: **24.4 weeks** or **5.1 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) diff --git a/admin/language/en-GB/en-GB.com_getbible.ini b/admin/language/en-GB/en-GB.com_getbible.ini index 76f12df..3e56ce3 100644 --- a/admin/language/en-GB/en-GB.com_getbible.ini +++ b/admin/language/en-GB/en-GB.com_getbible.ini @@ -1685,7 +1685,7 @@ COM_GETBIBLE_THE_TAG_WAS_SUCCESSFULLY_REACTIVATED="The tag was successfully reac COM_GETBIBLE_THE_TAG_WAS_SUCCESSFULLY_REMOVED_FROM_THE_VERSE="The tag was successfully removed from the verse." COM_GETBIBLE_THE_TAG_WAS_SUCCESSFULLY_UPDATED="The tag was successfully updated." COM_GETBIBLE_THE_VERSE_WAS_SUCCESSFULLY_TAGGED="The verse was successfully tagged." -COM_GETBIBLE_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION="The wiki can only be loaded when your JCB system has internet connection." +COM_GETBIBLE_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_GETBIBLE_SYSTEM_HAS_INTERNET_CONNECTION="The wiki can only be loaded when your getBible system has internet connection." COM_GETBIBLE_THE_WIKI_IS_LOADING="The wiki is loading" COM_GETBIBLE_THIS_IS_A_GLOBAL_TAG_SET_BY_US_AT_BSB_FOR_YOUR_CONVENIENCE_WE_HOLD_THE_PRIVILEGE_TO_MODIFY_THESE_TAGS_IF_YOU_BELIEVE_ITS_SET_IN_ERROR_KINDLY_INFORM_US="This is a global tag, set by us at %s for your convenience. We hold the privilege to modify these tags. If you believe it's set in error, kindly inform us." COM_GETBIBLE_THIS_TAG_COULD_NOT_BE_REMOVED="This tag could not be removed." diff --git a/admin/services/provider.php b/admin/services/provider.php index 6fe95eb..e2f53cc 100644 --- a/admin/services/provider.php +++ b/admin/services/provider.php @@ -15,53 +15,12 @@ /------------------------------------------------------------------------------------------------------*/ - - -// register additional namespace -\spl_autoload_register(function ($class) { - // project-specific base directories and namespace prefix - $search = [ - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible' => 'TrueChristianChurch\\Joomla\\GetBible', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Openai' => 'TrueChristianChurch\\Joomla\\Openai', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Gitea' => 'TrueChristianChurch\\Joomla\\Gitea', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla' => 'TrueChristianChurch\\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 = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; - // if the file exists, require it - if (file_exists($file)) - { - require $file; - } -}); +// The power autoloader for this project (JPATH_ADMINISTRATOR) area. +$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_getbible/src/Helper/PowerloaderHelper.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} // (soon) use Joomla\CMS\Association\AssociationExtensionInterface; use Joomla\CMS\Categories\CategoryFactoryInterface; diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 12bc0d7..ac186a8 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_linker` ( `name` VARCHAR(255) NOT NULL DEFAULT '', `public_notes` TINYINT(1) NOT NULL DEFAULT 0, `public_tagged_verses` TINYINT(1) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_note` ( `linker` VARCHAR(36) NOT NULL DEFAULT '', `note` TEXT NOT NULL, `verse` INT(7) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -77,7 +77,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_tagged_verse` ( `linker` VARCHAR(36) NOT NULL DEFAULT '', `tag` VARCHAR(36) NOT NULL DEFAULT '', `verse` INT(7) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -106,7 +106,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_tagged_verse` ( CREATE TABLE IF NOT EXISTS `#__getbible_prompt` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `abbreviation` VARCHAR(100) NOT NULL DEFAULT '', + `abbreviation` VARCHAR(100) NOT NULL, `ai_org_token_override` TINYINT(1) NOT NULL DEFAULT 0, `cache_behaviour` TINYINT(1) NOT NULL DEFAULT 0, `cache_capacity` INT(11) NOT NULL DEFAULT 0, @@ -131,7 +131,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_prompt` ( `token_override` TINYINT(1) NOT NULL DEFAULT 0, `top_p` FLOAT(11) NOT NULL DEFAULT 0, `top_p_override` TINYINT(1) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -160,30 +160,30 @@ CREATE TABLE IF NOT EXISTS `#__getbible_prompt` ( CREATE TABLE IF NOT EXISTS `#__getbible_open_ai_response` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `abbreviation` VARCHAR(100) NOT NULL DEFAULT '', + `abbreviation` VARCHAR(100) NOT NULL, `book` INT(11) NOT NULL DEFAULT 0, `chapter` INT(11) NOT NULL DEFAULT 0, `completion_tokens` INT(11) NOT NULL DEFAULT 0, `frequency_penalty` FLOAT(11) NOT NULL DEFAULT 0, - `language` VARCHAR(255) NOT NULL DEFAULT '', - `lcsh` VARCHAR(255) NOT NULL DEFAULT '', + `language` VARCHAR(255) NOT NULL, + `lcsh` VARCHAR(255) NOT NULL, `max_tokens` INT(11) NOT NULL DEFAULT 0, `model` VARCHAR(50) NOT NULL DEFAULT '', `n` INT(7) NOT NULL DEFAULT 0, `presence_penalty` FLOAT(11) NOT NULL DEFAULT 0, - `prompt` VARCHAR(36) NOT NULL DEFAULT '', + `prompt` VARCHAR(36) NOT NULL, `prompt_tokens` INT(11) NOT NULL DEFAULT 0, - `response_created` VARCHAR(255) NOT NULL DEFAULT '', - `response_id` VARCHAR(255) NOT NULL DEFAULT '', - `response_model` VARCHAR(255) NOT NULL DEFAULT '', - `response_object` VARCHAR(255) NOT NULL DEFAULT '', + `response_created` VARCHAR(255) NOT NULL, + `response_id` VARCHAR(255) NOT NULL, + `response_model` VARCHAR(255) NOT NULL, + `response_object` VARCHAR(255) NOT NULL, `selected_word` TEXT NOT NULL, `temperature` FLOAT(11) NOT NULL DEFAULT 0, `top_p` FLOAT(11) NOT NULL DEFAULT 0, `total_tokens` INT(11) NOT NULL DEFAULT 0, - `verse` VARCHAR(255) NOT NULL DEFAULT '', - `word` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `verse` VARCHAR(255) NOT NULL, + `word` VARCHAR(255) NOT NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -226,10 +226,10 @@ CREATE TABLE IF NOT EXISTS `#__getbible_open_ai_message` ( `index` INT(11) NOT NULL DEFAULT 0, `name` VARCHAR(255) NOT NULL DEFAULT '', `open_ai_response` VARCHAR(255) NOT NULL DEFAULT '', - `prompt` VARCHAR(36) NOT NULL DEFAULT '', + `prompt` VARCHAR(36) NOT NULL, `role` VARCHAR(255) NOT NULL DEFAULT '', `source` TINYINT(1) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -260,7 +260,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_password` ( `linker` VARCHAR(36) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', `password` VARCHAR(100) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -291,7 +291,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_tag` ( `guid` VARCHAR(36) NOT NULL DEFAULT '', `linker` VARCHAR(36) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -333,7 +333,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_translation` ( `language` VARCHAR(100) NOT NULL DEFAULT '', `sha` VARCHAR(64) NOT NULL DEFAULT '', `translation` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -361,7 +361,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_book` ( `name` VARCHAR(255) NOT NULL DEFAULT '', `nr` INT(7) NOT NULL DEFAULT 0, `sha` VARCHAR(64) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -392,7 +392,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_chapter` ( `chapter` INT(7) NOT NULL DEFAULT 0, `name` VARCHAR(255) NOT NULL DEFAULT '', `sha` VARCHAR(64) NOT NULL DEFAULT '', - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -425,7 +425,7 @@ CREATE TABLE IF NOT EXISTS `#__getbible_verse` ( `name` VARCHAR(255) NOT NULL DEFAULT '', `text` TEXT NOT NULL, `verse` INT(7) NOT NULL DEFAULT 0, - `params` text NULL, + `params` TEXT NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, diff --git a/admin/sql/updates/mysql/3.0.8.sql b/admin/sql/updates/mysql/3.0.9.sql similarity index 100% rename from admin/sql/updates/mysql/3.0.8.sql rename to admin/sql/updates/mysql/3.0.9.sql diff --git a/admin/sql/updates/mysql/4.0.11.sql b/admin/sql/updates/mysql/4.0.11.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/admin/sql/updates/mysql/4.0.11.sql @@ -0,0 +1 @@ + diff --git a/admin/src/Controller/TranslationsController.php b/admin/src/Controller/TranslationsController.php index 0cfa40c..96853aa 100644 --- a/admin/src/Controller/TranslationsController.php +++ b/admin/src/Controller/TranslationsController.php @@ -83,7 +83,7 @@ class TranslationsController extends AdminController { // Redirect to the list screen with error. $message = Text::_('COM_GETBIBLE_YOU_DO_NOT_HAVE_PERMISSION_TO_UPDATE_THE_BOOK_NAMES_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); - $this->setRedirect(\JRoute::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); + $this->setRedirect(Route::_('index.php?option=com_getbible&view=translations', false), $message, 'error'); return; } // Redirect to the list screen with error. diff --git a/admin/src/Helper/GetbibleHelper.php b/admin/src/Helper/GetbibleHelper.php index 837e980..275a36a 100644 --- a/admin/src/Helper/GetbibleHelper.php +++ b/admin/src/Helper/GetbibleHelper.php @@ -16,53 +16,12 @@ /------------------------------------------------------------------------------------------------------*/ namespace TrueChristianChurch\Component\Getbible\Administrator\Helper; - - -// register additional namespace -\spl_autoload_register(function ($class) { - // project-specific base directories and namespace prefix - $search = [ - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible' => 'TrueChristianChurch\\Joomla\\GetBible', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Openai' => 'TrueChristianChurch\\Joomla\\Openai', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Gitea' => 'TrueChristianChurch\\Joomla\\Gitea', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla' => 'TrueChristianChurch\\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 = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; - // if the file exists, require it - if (file_exists($file)) - { - require $file; - } -}); +// The power autoloader for this project (JPATH_ADMINISTRATOR) area. +$power_autoloader = JPATH_ADMINISTRATOR . '/components/com_getbible/src/Helper/PowerloaderHelper.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; @@ -82,6 +41,7 @@ use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use TrueChristianChurch\Joomla\GetBible\Factory as GetBibleFactory; +use TrueChristianChurch\Joomla\Gitea\Factory as GiteaFactory; use TrueChristianChurch\Joomla\Utilities\StringHelper as UtilitiesStringHelper; use TrueChristianChurch\Joomla\Utilities\ObjectHelper; use TrueChristianChurch\Joomla\Utilities\GetHelper; diff --git a/admin/src/Helper/PowerloaderHelper.php b/admin/src/Helper/PowerloaderHelper.php new file mode 100644 index 0000000..c039ae3 --- /dev/null +++ b/admin/src/Helper/PowerloaderHelper.php @@ -0,0 +1,65 @@ + + @git Get Bible + @github Get Bible + @support Get Bible + @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/TrueChristianChurch.Joomla.GetBible' => 'TrueChristianChurch\\Joomla\\GetBible', + 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Openai' => 'TrueChristianChurch\\Joomla\\Openai', + 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Gitea' => 'TrueChristianChurch\\Joomla\\Gitea', + 'libraries/vendor_getbible/TrueChristianChurch.Joomla' => 'TrueChristianChurch\\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 = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); diff --git a/admin/src/Model/AjaxModel.php b/admin/src/Model/AjaxModel.php index ad5155b..e37a618 100644 --- a/admin/src/Model/AjaxModel.php +++ b/admin/src/Model/AjaxModel.php @@ -160,34 +160,47 @@ class AjaxModel extends ListModel // do we have tags returned if (isset($tags[0]) && isset($tags[0]->name)) { - // get the version + // get the local version $manifest = GetbibleHelper::manifest(); $local_version = (string) $manifest->version; - $current_version = trim($tags[0]->name, 'vV'); + $latest_version = '1.0.0'; + $download_link = "https://git.vdm.dev/api/v1/getBible/joomla-component"; + + // Filter tags by major version matching the local version's major number + $major_version = explode('.', $local_version)[0]; + $filtered_tags = array_filter($tags, function($tag) use ($major_version) { + return strpos($tag->name, "v$major_version") === 0; + }); + + if (!empty($filtered_tags)) + { + // Sort versions to find the latest one + usort($filtered_tags, function($a, $b) { + return \version_compare($b->name, $a->name); + }); + + $latest_version = trim($filtered_tags[0]->name, 'vV'); + + // download link of the latest version + $download_link = $filtered_tags[0]->zipball_url; + } // now check if this version is out dated - if ($current_version === $local_version) + if (\version_compare($local_version, $latest_version) === 0) { return ['notice' => ' ' . Text::_('COM_GETBIBLE_UP_TO_DATE') . '']; } else { // check if this is beta version - $current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version)); - $local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version)); - if (($local_array[0] > $current_array[0]) || - ($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) || - ($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2])) + if (\version_compare($local_version, $latest_version) > 0) { return ['notice' => ' ' . Text::_('COM_GETBIBLE_PRE_RELEASE') . '']; } else { - // download link of the latest version - $download = "https://git.vdm.dev/api/v1/repos/getBible/joomla-component/archive/" . $tags[0]->name . ".zip"; - return ['notice' => ' ' . Text::_('COM_GETBIBLE_OUT_OF_DATE') . '! ' . Text::_('COM_GETBIBLE_DOWNLOAD_UPDATE') . '!']; + $download_link . '" title="' . Text::_('COM_GETBIBLE_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '">' . Text::_('COM_GETBIBLE_DOWNLOAD_UPDATE') . '!']; } } } @@ -276,6 +289,6 @@ class AjaxModel extends ListModel return ['error' => $message]; } - return ['error' => Text::_('COM_GETBIBLE_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_JCB_SYSTEM_HAS_INTERNET_CONNECTION')]; + return ['error' => Text::_('COM_GETBIBLE_THE_WIKI_CAN_ONLY_BE_LOADED_WHEN_YOUR_GETBIBLE_SYSTEM_HAS_INTERNET_CONNECTION')]; } } diff --git a/getbible.xml b/getbible.xml index 1f959b4..735f7e1 100644 --- a/getbible.xml +++ b/getbible.xml @@ -1,15 +1,15 @@ COM_GETBIBLE - 6th April, 2024 + 27th April, 2024 Llewellyn van der Merwe joomla@vdm.io https://getbible.net Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 4.0.11 + 4.0.12 Get Bible (v.4.0.11) +

Get Bible (v.4.0.12)

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. diff --git a/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/AI/Engineer.php b/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/AI/Engineer.php index db23749..6f7da0d 100644 --- a/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/AI/Engineer.php +++ b/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/AI/Engineer.php @@ -179,7 +179,7 @@ final class Engineer $data->top_p = $this->prompt->getTopP(); $data->presence_penalty = $this->prompt->getPresencePenalty(); $data->frequency_penalty = $this->prompt->getFrequencyPenalty(); - $data->n = ''; + $data->n = 0; // Response data $data->response_id = $this->response->id ?? ''; $data->response_object = $this->response->object ?? ''; diff --git a/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table.php b/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table.php index 6945951..3d878e8 100644 --- a/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table.php +++ b/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table.php @@ -39,6 +39,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'linkers', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'guid' => [ 'name' => 'guid', @@ -48,6 +55,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'linkers', 'store' => NULL, 'tab_name' => 'publishing', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'public_tagged_verses' => [ 'name' => 'public_tagged_verses', @@ -57,6 +71,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'linkers', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'public_notes' => [ 'name' => 'public_notes', @@ -66,6 +87,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'linkers', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], 'note' => [ @@ -77,6 +119,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'notes', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'linker' => [ 'name' => 'linker', @@ -86,6 +135,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'notes', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'access' => [ 'name' => 'access', @@ -95,6 +151,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'notes', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'guid' => [ 'name' => 'guid', @@ -104,6 +167,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'notes', 'store' => NULL, 'tab_name' => 'publishing', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'note' => [ 'name' => 'note', @@ -113,6 +183,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'notes', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'verse' => [ 'name' => 'verse', @@ -122,6 +199,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'notes', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'chapter' => [ 'name' => 'chapter', @@ -131,6 +215,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'notes', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], ], 'tagged_verse' => [ @@ -142,6 +233,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tagged_verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'abbreviation' => [ 'name' => 'abbreviation', @@ -151,6 +249,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tagged_verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'access' => [ 'name' => 'access', @@ -160,6 +265,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tagged_verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'linker' => [ 'name' => 'linker', @@ -169,6 +281,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tagged_verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'tag' => [ 'name' => 'tag', @@ -178,6 +297,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tagged_verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'guid' => [ 'name' => 'guid', @@ -187,6 +313,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tagged_verses', 'store' => NULL, 'tab_name' => 'publishing', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'verse' => [ 'name' => 'verse', @@ -196,6 +329,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tagged_verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'chapter' => [ 'name' => 'chapter', @@ -205,6 +345,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tagged_verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], ], 'prompt' => [ @@ -216,6 +363,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'integration' => [ 'name' => 'integration', @@ -225,6 +379,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '1', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'cache_behaviour' => [ 'name' => 'cache_behaviour', @@ -234,6 +395,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'abbreviation' => [ 'name' => 'abbreviation', @@ -243,6 +411,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'guid' => [ 'name' => 'guid', @@ -252,6 +427,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'publishing', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'model' => [ 'name' => 'model', @@ -261,6 +443,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'VARCHAR(50)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'presence_penalty' => [ 'name' => 'presence_penalty', @@ -270,6 +459,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'FLOAT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'org_token' => [ 'name' => 'org_token', @@ -279,6 +475,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'token' => [ 'name' => 'token', @@ -288,6 +491,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'n_override' => [ 'name' => 'n_override', @@ -297,6 +507,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'cache_capacity' => [ 'name' => 'cache_capacity', @@ -306,6 +523,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'messages' => [ 'name' => 'messages', @@ -315,6 +539,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => 'json', 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'response_retrieval' => [ 'name' => 'response_retrieval', @@ -324,6 +555,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'frequency_penalty_override' => [ 'name' => 'frequency_penalty_override', @@ -333,6 +571,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'n' => [ 'name' => 'n', @@ -342,6 +587,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'max_tokens_override' => [ 'name' => 'max_tokens_override', @@ -351,6 +603,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'token_override' => [ 'name' => 'token_override', @@ -360,6 +619,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'max_tokens' => [ 'name' => 'max_tokens', @@ -369,6 +635,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'ai_org_token_override' => [ 'name' => 'ai_org_token_override', @@ -378,6 +651,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'temperature_override' => [ 'name' => 'temperature_override', @@ -387,6 +667,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'presence_penalty_override' => [ 'name' => 'presence_penalty_override', @@ -396,6 +683,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'top_p_override' => [ 'name' => 'top_p_override', @@ -405,6 +699,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'frequency_penalty' => [ 'name' => 'frequency_penalty', @@ -414,6 +715,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'FLOAT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'top_p' => [ 'name' => 'top_p', @@ -423,6 +731,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'FLOAT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'temperature' => [ 'name' => 'temperature', @@ -432,6 +747,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'prompts', 'store' => NULL, 'tab_name' => 'Open AI', + 'db' => [ + 'type' => 'FLOAT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], 'open_ai_response' => [ @@ -443,6 +779,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'prompt' => [ 'name' => 'prompt', @@ -452,6 +795,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'response_object' => [ 'name' => 'response_object', @@ -461,6 +811,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'response_model' => [ 'name' => 'response_model', @@ -470,6 +827,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'total_tokens' => [ 'name' => 'total_tokens', @@ -479,6 +843,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'n' => [ 'name' => 'n', @@ -488,6 +859,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'frequency_penalty' => [ 'name' => 'frequency_penalty', @@ -497,6 +875,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'FLOAT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'presence_penalty' => [ 'name' => 'presence_penalty', @@ -506,6 +891,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'FLOAT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'word' => [ 'name' => 'word', @@ -515,6 +907,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Bible', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'chapter' => [ 'name' => 'chapter', @@ -524,6 +923,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Bible', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'lcsh' => [ 'name' => 'lcsh', @@ -533,6 +939,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Bible', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'completion_tokens' => [ 'name' => 'completion_tokens', @@ -542,6 +955,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'prompt_tokens' => [ 'name' => 'prompt_tokens', @@ -551,6 +971,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'response_created' => [ 'name' => 'response_created', @@ -560,6 +987,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'abbreviation' => [ 'name' => 'abbreviation', @@ -569,6 +1003,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Bible', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'language' => [ 'name' => 'language', @@ -578,6 +1019,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Bible', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'max_tokens' => [ 'name' => 'max_tokens', @@ -587,6 +1035,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'book' => [ 'name' => 'book', @@ -596,6 +1051,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Bible', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'temperature' => [ 'name' => 'temperature', @@ -605,6 +1067,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'FLOAT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'verse' => [ 'name' => 'verse', @@ -614,6 +1083,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Bible', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'top_p' => [ 'name' => 'top_p', @@ -623,6 +1099,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'FLOAT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'selected_word' => [ 'name' => 'selected_word', @@ -632,6 +1115,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Bible', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'model' => [ 'name' => 'model', @@ -641,6 +1131,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_responses', 'store' => NULL, 'tab_name' => 'Prompt', + 'db' => [ + 'type' => 'VARCHAR(50)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], 'open_ai_message' => [ @@ -652,6 +1163,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_messages', 'store' => NULL, 'tab_name' => 'Message', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'open_ai_response' => [ 'name' => 'open_ai_response', @@ -661,6 +1179,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_messages', 'store' => NULL, 'tab_name' => 'Message', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'prompt' => [ 'name' => 'prompt', @@ -670,6 +1195,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_messages', 'store' => NULL, 'tab_name' => 'Message', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'source' => [ 'name' => 'source', @@ -679,6 +1211,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_messages', 'store' => NULL, 'tab_name' => 'Message', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'content' => [ 'name' => 'content', @@ -688,6 +1227,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_messages', 'store' => NULL, 'tab_name' => 'Message', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'name' => [ 'name' => 'name', @@ -697,6 +1243,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_messages', 'store' => NULL, 'tab_name' => 'Message', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'index' => [ 'name' => 'index', @@ -706,6 +1259,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'open_ai_messages', 'store' => NULL, 'tab_name' => 'Message', + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], 'password' => [ @@ -717,6 +1291,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'passwords', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'linker' => [ 'name' => 'linker', @@ -726,6 +1307,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'passwords', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'guid' => [ 'name' => 'guid', @@ -735,6 +1323,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'passwords', 'store' => NULL, 'tab_name' => 'publishing', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'password' => [ 'name' => 'password', @@ -744,6 +1339,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'passwords', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], 'tag' => [ @@ -755,6 +1371,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tags', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'linker' => [ 'name' => 'linker', @@ -764,6 +1387,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tags', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'access' => [ 'name' => 'access', @@ -773,6 +1403,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tags', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TINYINT(1)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'guid' => [ 'name' => 'guid', @@ -782,6 +1419,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tags', 'store' => NULL, 'tab_name' => 'publishing', + 'db' => [ + 'type' => 'VARCHAR(36)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'description' => [ 'name' => 'description', @@ -791,6 +1435,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'tags', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NULL', + 'unique_key' => false, + 'key' => false, + ], ], ], 'translation' => [ @@ -802,6 +1453,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'abbreviation' => [ 'name' => 'abbreviation', @@ -811,6 +1469,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'language' => [ 'name' => 'language', @@ -820,6 +1485,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'direction' => [ 'name' => 'direction', @@ -829,6 +1501,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_history' => [ 'name' => 'distribution_history', @@ -838,6 +1517,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => 'json', 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_about' => [ 'name' => 'distribution_about', @@ -847,6 +1533,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_license' => [ 'name' => 'distribution_license', @@ -856,6 +1549,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_source' => [ 'name' => 'distribution_source', @@ -865,6 +1565,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_sourcetype' => [ 'name' => 'distribution_sourcetype', @@ -874,6 +1581,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_versification' => [ 'name' => 'distribution_versification', @@ -883,6 +1597,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'sha' => [ 'name' => 'sha', @@ -892,6 +1613,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'encoding' => [ 'name' => 'encoding', @@ -901,6 +1629,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_lcsh' => [ 'name' => 'distribution_lcsh', @@ -910,6 +1645,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_version_date' => [ 'name' => 'distribution_version_date', @@ -919,6 +1661,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_version' => [ 'name' => 'distribution_version', @@ -928,6 +1677,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'lang' => [ 'name' => 'lang', @@ -937,6 +1693,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'distribution_abbreviation' => [ 'name' => 'distribution_abbreviation', @@ -946,6 +1709,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'translations', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], 'book' => [ @@ -957,6 +1741,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'books', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'abbreviation' => [ 'name' => 'abbreviation', @@ -966,6 +1757,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'books', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'nr' => [ 'name' => 'nr', @@ -975,6 +1773,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'books', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'sha' => [ 'name' => 'sha', @@ -984,6 +1789,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'books', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], 'chapter' => [ @@ -995,6 +1821,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'chapters', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'chapter' => [ 'name' => 'chapter', @@ -1004,6 +1837,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'chapters', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'book_nr' => [ 'name' => 'book_nr', @@ -1013,6 +1853,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'chapters', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'abbreviation' => [ 'name' => 'abbreviation', @@ -1022,6 +1869,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'chapters', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'sha' => [ 'name' => 'sha', @@ -1031,6 +1885,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'chapters', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(64)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], 'verse' => [ @@ -1042,6 +1917,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'chapter' => [ 'name' => 'chapter', @@ -1051,6 +1933,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'verse' => [ 'name' => 'verse', @@ -1060,6 +1949,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'INT(7)', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'abbreviation' => [ 'name' => 'abbreviation', @@ -1069,6 +1965,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(100)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], ], 'text' => [ 'name' => 'text', @@ -1078,6 +1981,13 @@ class Table extends BaseTable implements Tableinterface 'list' => 'verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => false, + ], ], 'name' => [ 'name' => 'name', @@ -1087,6 +1997,27 @@ class Table extends BaseTable implements Tableinterface 'list' => 'verses', 'store' => NULL, 'tab_name' => 'Details', + 'db' => [ + 'type' => 'VARCHAR(255)', + 'default' => '', + 'null_switch' => 'NOT NULL', + 'unique_key' => false, + 'key' => true, + ], + ], + 'access' => [ + 'name' => 'access', + 'label' => 'Access', + 'type' => 'accesslevel', + 'title' => false, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'key' => true, + 'null_switch' => 'NOT NULL', + ], ], ], ]; diff --git a/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table/Schema.php b/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table/Schema.php new file mode 100644 index 0000000..fe7e44a --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table/Schema.php @@ -0,0 +1,52 @@ + + * @git GetBible + * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace TrueChristianChurch\Joomla\GetBible\Table; + + +use TrueChristianChurch\Joomla\GetBible\Table; +use TrueChristianChurch\Joomla\Interfaces\SchemaInterface; +use TrueChristianChurch\Joomla\Abstraction\Schema as ExtendingSchema; + + +/** + * GetBible Tables Schema + * + * @since 3.0.8 + */ +final class Schema extends ExtendingSchema implements SchemaInterface +{ + /** + * Constructor. + * + * @param Table $table The Table Class. + * + * @since 3.0.8 + */ + public function __construct(?Table $table = null) + { + $table ??= new Table; + + parent::__construct($table); + } + + /** + * Get the targeted component code + * + * @return string + * @since 3.0.8 + */ + protected function getCode(): string + { + return 'getbible'; + } +} + diff --git a/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Utilities/index.html b/libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table/index.html similarity index 100% rename from libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Utilities/index.html rename to libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible/src/Table/index.html diff --git a/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Abstraction/BaseTable.php b/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Abstraction/BaseTable.php index c5104ea..280107f 100644 --- a/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Abstraction/BaseTable.php +++ b/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Abstraction/BaseTable.php @@ -34,7 +34,7 @@ abstract class BaseTable implements Tableinterface * All default fields * * @var array - * @since 3.2.0 + * @since 3.2.1 **/ protected array $defaults = [ 'id' => [ @@ -45,7 +45,29 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(11)', + 'default' => 'EMPTY', + 'auto_increment' => true, + 'primary_key' => true, + 'null_switch' => 'NOT NULL' + ] + ], + 'asset_id' => [ + 'name' => 'asset_id', + 'label' => NULL, + 'type' => NULL, + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'comment' => 'FK to the #__assets table.' + ] ], 'ordering' => [ 'name' => 'ordering', @@ -54,7 +76,12 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(11)', + 'default' => '0', + 'null_switch' => 'NOT NULL' + ] ], 'published' => [ 'name' => 'published', @@ -63,7 +90,14 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'TINYINT(3)', + 'default' => '1', + 'null_switch' => 'NOT NULL', + 'key' => true, + 'key_name' => 'state' + ] ], 'modified_by' => [ 'name' => 'modified_by', @@ -72,7 +106,14 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'key' => true, + 'key_name' => 'modifiedby' + ] ], 'modified' => [ 'name' => 'modified', @@ -81,7 +122,12 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'DATETIME', + 'default' => '0000-00-00 00:00:00', + 'null_switch' => 'NOT NULL' + ] ], 'created_by' => [ 'name' => 'created_by', @@ -90,7 +136,14 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'key' => true, + 'key_name' => 'createdby' + ] ], 'created' => [ 'name' => 'created', @@ -99,7 +152,42 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'DATETIME', + 'default' => '0000-00-00 00:00:00', + 'null_switch' => 'NOT NULL' + ] + ], + 'checked_out' => [ + 'name' => 'checked_out', + 'label' => NULL, + 'type' => NULL, + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'null_switch' => 'NOT NULL', + 'key' => true, + 'key_name' => 'checkout' + ] + ], + 'checked_out_time' => [ + 'name' => 'checked_out_time', + 'label' => NULL, + 'type' => NULL, + 'title' => false, + 'list' => NULL, + 'store' => NULL, + 'tab_name' => NULL, + 'db' => [ + 'type' => 'DATETIME', + 'default' => '0000-00-00 00:00:00', + 'null_switch' => 'NOT NULL' + ] ], 'hits' => [ 'name' => 'hits', @@ -108,7 +196,12 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '0', + 'null_switch' => 'NOT NULL' + ] ], 'version' => [ 'name' => 'version', @@ -117,7 +210,26 @@ abstract class BaseTable implements Tableinterface 'title' => false, 'list' => NULL, 'store' => NULL, - 'tab_name' => NULL + 'tab_name' => NULL, + 'db' => [ + 'type' => 'INT(10) unsigned', + 'default' => '1', + 'null_switch' => 'NOT NULL' + ] + ], + 'params' => [ + 'name' => 'params', + 'label' => NULL, + 'type' => NULL, + 'title' => false, + 'list' => NULL, + 'store' => 'json', + 'tab_name' => NULL, + 'db' => [ + 'type' => 'TEXT', + 'default' => 'EMPTY', + 'null_switch' => 'NULL' + ] ] ]; @@ -130,48 +242,41 @@ abstract class BaseTable implements Tableinterface * Example: $this->get('table_name'); * Get all areas/views/tables with all their item/field/column details * Example: $this->get('All'); + * Example: $this->get(); * - * @param string $table The table + * @param string|null $table The table * @param string|null $field The field * @param string|null $key The value key * * @return mixed - * @since 3.2.0 + * @since 3.2.1 */ - public function get(string $table, ?string $field = null, ?string $key = null) + public function get(?string $table = null, ?string $field = null, ?string $key = null) { - // return the item/field/column of an area/view/table - if (is_string($field) && is_string($key)) + // Return specific value + if ($table && $field && $key) { - // return the value of a item/field/column of an area/view/table - if (isset($this->tables[$table][$field][$key])) - { - return $this->tables[$table][$field][$key]; - } - - return $this->getDefaultKey($field, $key); - } - // return the item/field/column of an area/view/table - elseif (is_string($field)) - { - if (isset($this->tables[$table][$field])) - { - return $this->tables[$table][$field]; - } - - return $this->getDefault($field); - } - // return an area/view/table - elseif ($table !== 'All') - { - if (isset($this->tables[$table])) - { - return $this->tables[$table]; - } - return null; + return $this->tables[$table][$field][$key] ?? $this->getDefaultKey($field, $key); } - // return all + // Return field within table + if ($table && $field) + { + return $this->tables[$table][$field] ?? $this->getDefault($field); + } + + // Return all fields in a table or all tables if 'All' is passed + if ($table) + { + if (strtoupper($table) === 'ALL') + { + return $this->tables; + } + + return $this->tables[$table] ?? null; + } + + // Return all tables return $this->tables; } @@ -268,27 +373,30 @@ abstract class BaseTable implements Tableinterface * * @param string $table The area * @param bool $default Add the default fields + * @param bool $details Add/Leave fields the details * * @return array|null On success an array of fields * @since 3.2.0 */ - public function fields(string $table, bool $default = false): ?array + public function fields(string $table, bool $default = false, bool $details = false): ?array { - // return all fields of an area/view/table - if (($table = $this->get($table)) !== null) + // Retrieve fields from the specified table + $fields = $this->get($table); + + if ($fields === null) { - if ($default) - { - return $this->addDefault(array_keys($table)); - } - else - { - return array_keys($table); - } + return null; } - // none found - return null; + // Determine the fields output based on the $default and $details flags + if ($details) + { + return $default ? $this->addDefaultDetails($fields) : $fields; + } + + $fieldKeys = array_keys($fields); + + return $default ? $this->addDefault($fieldKeys) : $fieldKeys; } /** @@ -304,6 +412,11 @@ abstract class BaseTable implements Tableinterface // add default fields foreach ($this->defaults as $default) { + if (in_array($default['name'], $fields)) + { + continue; + } + // used just for loading the fields $order = $default['order'] ?? 1; unset($default['order']); @@ -321,6 +434,31 @@ abstract class BaseTable implements Tableinterface return $fields; } + /** + * Add the default fields + * + * @param array $fields The table dynamic fields + * + * @return array Fields (with defaults details added) + * @since 3.2.0 + */ + protected function addDefaultDetails(array $fields): array + { + // add default fields + foreach ($this->defaults as $default) + { + // remove ordering for now + unset($default['order']); + + if (!isset($fields[$default['name']])) + { + $fields[$default['name']] = $default; + } + } + + return $fields; + } + /** * Check if the field is a default field * @@ -353,10 +491,10 @@ abstract class BaseTable implements Tableinterface * @param string $field The field to check * @param string $key The field key/property to check * - * @return string|null String value if a default field property exist + * @return mixed String value if a default field property exist * @since 3.2.0 */ - protected function getDefaultKey(string $field, string $key): ?string + protected function getDefaultKey(string $field, string $key) { return $this->defaults[$field][$key] ?? null; } diff --git a/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Abstraction/Schema.php b/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Abstraction/Schema.php new file mode 100644 index 0000000..6bf8fd4 --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Abstraction/Schema.php @@ -0,0 +1,698 @@ + + * @git 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 TrueChristianChurch\Joomla\Abstraction; + + +use Joomla\CMS\Factory; +use Joomla\CMS\Version; +use TrueChristianChurch\Joomla\Interfaces\Tableinterface as Table; +use TrueChristianChurch\Joomla\Interfaces\SchemaInterface; + + +/** + * Schema Checking + * + * @since 3.2.1 + */ +abstract class Schema implements SchemaInterface +{ + /** + * The Table Class. + * + * @var Table + * @since 3.2.1 + */ + protected Table $table; + + /** + * The Database Class + * + * @since 3.2.1 + */ + protected $db; + + /** + * The local tables + * + * @var array + * @since 3.2.1 + */ + private array $tables; + + /** + * The component table prefix + * + * @var string + * @since 3.2.1 + */ + private string $prefix; + + /** + * The field unique keys + * + * @var array + * @since 3.2.1 + */ + private array $uniqueKeys; + + /** + * The field keys + * + * @var array + * @since 3.2.1 + */ + private array $keys; + + /** + * The current table columns + * + * @var array + * @since 3.2.1 + */ + private array $columns; + + /** + * The success messages of the action + * + * @var array + * @since 3.2.1 + */ + private array $success; + + /** + * Current Joomla Version We are IN + * + * @var int + * @since 3.2.1 + **/ + protected $currentVersion; + + /** + * Constructor. + * + * @param Table $table The Table Class. + * + * @since 3.2.1 + * @throws \Exception If the database fails + */ + public function __construct(Table $table) + { + $this->table = $table; + + try { + // set the database object + $this->db = Factory::getDbo(); + + // get current component tables + $this->tables = $this->db->getTableList(); + + // set the component table + $this->prefix = $this->db->getPrefix() . $this->getCode(); + + // set the current version + $this->currentVersion = Version::MAJOR_VERSION; + } catch (\Exception $e) { + throw new \Exception("Error: failed to initialize schema class due to a database error."); + } + } + + /** + * Check and update database schema for missing fields or tables. + * + * @return array The array of successful updates/actions, if empty no update/action was taken. + * @since 3.2.1 + * @throws \Exception If there is an error during the update process. + */ + public function update(): array + { + try { + $this->success = [ + "Success: scan of the component tables started." + ]; + foreach ($this->table->tables() as $table) + { + $this->uniqueKeys = []; + $this->keys = []; + + if ($this->tableExists($table)) + { + $this->updateSchema($table); + } + else + { + $this->createTable($table); + } + } + } catch (\Exception $e) { + throw new \Exception("Error: updating database schema. " . $e->getMessage()); + } + + if (count($this->success) == 1) + { + $this->success[] = "Success: scan of the component tables completed with no update needed."; + } + else + { + $this->success[] = "Success: scan of the component tables completed."; + } + + return $this->success; + } + + /** + * Get the targeted component code + * + * @return string + * @since 3.2.1 + */ + abstract protected function getCode(): string; + + /** + * Check if a table exists in the database. + * + * @param string $table The name of the table to check. + * + * @return bool True if table exists, False otherwise. + * @since 3.2.1 + */ + protected function tableExists(string $table): bool + { + return in_array($this->getTable($table), $this->tables); + } + + /** + * Update the schema of an existing table. + * + * @param string $table The table to update. + * + * @return void + * @since 3.2.1 + * @throws \Exception If there is an error while updating the schema. + */ + public function updateSchema(string $table): void + { + try { + $existingColumns = $this->getExistingColumns($table); + $expectedColumns = $this->table->fields($table, true); + + $missingColumns = array_diff($expectedColumns, $existingColumns); + + if (!empty($missingColumns)) + { + $this->addMissingColumns($table, $missingColumns); + } + + $this->checkColumnsDataType($table, $expectedColumns); + + } catch (\Exception $e) { + throw new \Exception("Error: updating schema for $table table. " . $e->getMessage()); + } + + if (!empty($missingColumns)) + { + $column_s = (count($missingColumns) == 1) ? 'column' : 'columns'; + $missingColumns = implode(', ', $missingColumns); + $this->success[] = "Success: added missing ($missingColumns) $column_s to $table table."; + } + } + + /** + * Create a table with all necessary fields. + * + * @param string $table The name of the table to create. + * + * @return void + * @since 3.2.1 + * @throws \Exception If there is an error creating the table. + */ + public function createTable(string $table): void + { + try { + $columns = []; + $fields = $this->table->fields($table, true); + $createTable = 'CREATE TABLE IF NOT EXISTS ' . $this->db->quoteName($this->getTable($table)); + + foreach ($fields as $field) + { + if (($def = $this->getColumnDefinition($table, $field)) !== null) + { + $columns[] = $def; + } + } + + $columnDefinitions = implode(', ', $columns); + + $keys = $this->getTableKeys(); + + $createTableSql = "$createTable ($columnDefinitions, $keys)"; + + $this->db->setQuery($createTableSql); + $this->db->execute(); + } catch (\Exception $e) { + throw new \Exception("Error: failed to create missing $table table. " . $e->getMessage()); + } + + $this->success[] = "Success: created missing $table table."; + } + + /** + * Fetch existing columns from a database table. + * + * @param string $table The name of the table. + * + * @return array An array of column names. + * @since 3.2.1 + */ + protected function getExistingColumns(string $table): array + { + $this->columns = $this->db->getTableColumns($this->getTable($table), false); + + return array_keys($this->columns); + } + + /** + * Add missing columns to a table. + * + * @param string $table The table to update. + * @param array $columns List of missing columns/fields. + * + * @return void + * @since 3.2.1 + * @throws \Exception If there is an error adding columns. + */ + protected function addMissingColumns(string $table, array $columns): void + { + try { + $query = $this->db->getQuery(true); + $alterTable = 'ALTER TABLE ' . $this->db->quoteName($this->getTable($table)) . ' '; + + // Start an ALTER TABLE query + $alterQueries = []; + foreach ($columns as $column) + { + if (($def = $this->getColumnDefinition($table, $column)) !== null) + { + $alterQueries[] = " ADD " . $def; + } + } + + $this->db->setQuery($alterTable . implode(', ', $alterQueries)); + $this->db->execute(); + } catch (\Exception $e) { + $column_s = (count($columns) == 1) ? 'column' : 'columns'; + $columns = implode(', ', $columns); + throw new \Exception("Error: failed to add ($columns) $column_s to $table table. " . $e->getMessage()); + } + } + + /** + * Validate and update the data type of existing fields/columns + * + * @param string $table The table to update. + * @param array $columns List of columns/fields to check. + * + * @return void + * @since 3.2.1 + */ + protected function checkColumnsDataType(string $table, array $columns): void + { + $requireUpdate = []; + foreach ($columns as $column) + { + $current = $this->columns[$column] ?? null; + if ($current === null || ($expected = $this->table->get($table, $column, 'db')) === null) + { + continue; + } + + // check if the data type and size match + if ($this->isDataTypeChangeSignificant($current->Type, $expected['type'])) + { + $requireUpdate[$column] = [ + 'column' => $column, + 'current' => $current->Type, + 'expected' => $expected['type'] + ]; + + // check if update of default values is needed + $this->checkDefault($table, $column); + } + } + + if (!empty($requireUpdate)) + { + $this->updateColumnsDataType($table, $requireUpdate); + } + } + + /** + * Generates a SQL snippet for defining a table column, incorporating column type, + * default value, nullability, and auto-increment properties. + * + * @param string $table The table name to be used. + * @param string $field The field name in the table to generate SQL for. + * + * @return string|null The SQL snippet for the column definition. + * @since 3.2.1 + * @throws \Exception If the schema details cannot be retrieved or the SQL statement cannot be constructed properly. + */ + protected function getColumnDefinition(string $table, string $field): ?string + { + try { + // Retrieve the database schema details for the specified table and field + if (($db = $this->table->get($table, $field, 'db')) === null) + { + return null; + } + + // Prepare the column name + $column_name = $this->db->quoteName($field); + $db['name'] = $field; + + // Prepare the type and default value SQL statement + $type = $db['type'] ?? 'TEXT'; + $db_default = isset($db['default']) ? $db['default'] : null; + $default = $this->getDefaultValue($type, $db_default); + + // Prepare the null switch, and auto increment statement + $null_switch = !empty($db['null_switch']) ? " " . $db['null_switch'] : ''; + $auto_increment = !empty($db['auto_increment']) ? " AUTO_INCREMENT" : ''; + + $this->setKeys($db); + + // Assemble the SQL snippet for the column definition + return "{$column_name} {$type}{$null_switch}{$default}{$auto_increment}"; + } catch (\Exception $e) { + throw new \Exception("Error: failed to generate column definition for ($table.$field). " . $e->getMessage()); + } + } + + /** + * Check and Update the default values if needed, including existing data adjustments + * + * @param string $table The table to update. + * @param string $column The column/field to check. + * + * @return void + * @since 3.2.1 + */ + protected function checkDefault(string $table, string $column): void + { + // Retrieve the expected column configuration + $expected = $this->table->get($table, $column, 'db'); + + // Skip updates if the column is auto_increment + if (isset($expected['auto_increment']) && $expected['auto_increment']) + { + return; + } + + // Retrieve the current column configuration + $current = $this->columns[$column]; + + // Check if default should be empty and current default is null, skip processing + if (strtoupper($expected['default']) === 'EMPTY' && $current->Default === NULL) + { + return; + } + + // Determine the new default value based on the expected settings + $type = $expected['type'] ?? 'TEXT'; + $db_default = isset($expected['default']) ? $expected['default'] : null; + $newDefault = $this->getDefaultValue($type, $db_default, true); + + // First, adjust existing rows to conform to the new default if necessary + if (is_numeric($newDefault) && $this->adjustExistingDefaults($table, $column, $current->Default, $newDefault)) + { + $this->success[] = "Success: updated the ($column) defaults in $table table."; + } + } + + /** + * Update the data type of the given fields. + * + * @param string $table The table to update. + * @param array $columns List of columns/fields that must be updated. + * + * @return void + * @since 3.2.1 + */ + protected function updateColumnsDataType(string $table, array $columns): void + { + $alterTable = 'ALTER TABLE ' . $this->db->quoteName($this->getTable($table)); + foreach ($columns as $column => $types) + { + if (($def = $this->getColumnDefinition($table, $column)) === null) + { + continue; + } + + $dbField = $this->db->quoteName($column); + $alterQuery = "$alterTable CHANGE $dbField ". $def; + + if ($this->updateColumnDataType($alterQuery, $table, $column)) + { + $current = $types['current'] ?? 'error'; + $expected = $types['expected'] ?? 'error'; + $this->success[] = "Success: updated ($column) column datatype $current to $expected in $table table."; + } + } + } + + /** + * Add the component name to get the full table name. + * + * @param string $table The table name. + * + * @return void + * @since 3.2.1 + */ + protected function getTable(string $table): string + { + return $this->prefix . '_' . $table; + } + + /** + * Determines if the change in data type between two definitions is significant. + * + * This function checks if there's a significant difference between the current + * data type and the expected data type that would require updating the database schema. + * It ignores display width for numeric types where MySQL considers these attributes + * irrelevant for storage but considers size and other modifiers for types like VARCHAR. + * + * @param string $currentType The current data type from the database schema. + * @param string $expectedType The expected data type to validate against. + * + * @return bool Returns true if the data type change is significant, otherwise false. + * @since 3.2.1 + */ + protected function isDataTypeChangeSignificant(string $currentType, string $expectedType): bool + { + // Normalize both input types to lowercase for case-insensitive comparison + $currentType = strtolower($currentType); + $expectedType = strtolower($expectedType); + + // Regex to extract the base data type and numeric parameters with named groups + $typePattern = '/^(?\w+)(\((?\d+(,\d+)?)\))?/'; + + // Match types and parameters + preg_match($typePattern, $currentType, $currentMatches); + preg_match($typePattern, $expectedType, $expectedMatches); + + // Compare base types + if ($currentMatches['datatype'] !== $expectedMatches['datatype']) + { + return true; // Base types differ + } + + // Define types where size and other modifiers are irrelevant + $sizeIrrelevantTypes = [ + 'int', 'tinyint', 'smallint', 'mediumint', 'bigint', + 'float', 'double', 'decimal', 'numeric' // Numeric types where display width is irrelevant + ]; + + // If the type is not in the size irrelevant list, compare full definitions + if (!in_array($currentMatches['datatype'], $sizeIrrelevantTypes)) + { + return $currentType !== $expectedType; // Use full definition for types where size matters + } + + // For size irrelevant types, only compare base type, ignoring size and unsigned + $currentBaseType = preg_replace('/\(\d+(,\d+)?\)|unsigned/', '', $currentType); + $expectedBaseType = preg_replace('/\(\d+(,\d+)?\)|unsigned/', '', $expectedType); + + // Perform a final comparison for numeric types ignoring size + return $currentBaseType !== $expectedBaseType; + } + + /** + * Updates existing rows in a column to a new default value + * + * @param string $table The table to update. + * @param string $column The column to update. + * @param mixed $currentDefault Current default value. + * @param mixed $newDefault The new default value to be set. + * + * @return void + * @since 3.2.1 + * @throws \Exception If there is an error updating column defaults. + */ + protected function adjustExistingDefaults(string $table, string $column, $currentDefault, $newDefault): bool + { + // Determine if adjustment is needed based on new and current defaults + if ($newDefault !== $currentDefault) + { + try { + // Format the new default for SQL use + $sqlDefault = $this->db->quote($newDefault); + + $updateTable = 'UPDATE ' . $this->db->quoteName($this->getTable($table)); + $dbField = $this->db->quoteName($column); + + // Update SQL to set new default on existing rows where the default is currently the old default + $sql = $updateTable . " SET $dbField = $sqlDefault WHERE $dbField IS NULL OR $dbField = ''"; + + // Execute the update + $this->db->setQuery($sql); + return $this->db->execute(); + } catch (\Exception $e) { + throw new \Exception("Error: failed to update ($column) column defaults in $table table. " . $e->getMessage()); + } + } + return false; + } + + /** + * Update the data type of the given field. + * + * @param string $updateString The SQL command to update the column data type + * @param string $table The table to update. + * @param string $field Column/field that must be updated. + * + * @return bool true on succes + * @since 3.2.1 + * @throws \Exception If there is an error adding columns. + */ + protected function updateColumnDataType(string $updateString, string $table, string $field): bool + { + try { + $this->db->setQuery($updateString); + return $this->db->execute(); + } catch (\Exception $e) { + throw new \Exception("Error: failed to update the datatype of ($field) column in $table table. " . $e->getMessage()); + } + } + + /** + * Key all needed keys for this table + * + * @return string of keys + * @since 3.2.1 + */ + protected function getTableKeys(): string + { + $keys = []; + $keys[] = 'PRIMARY KEY (`id`)'; // TODO (we may want this to be dynamicly set) + + if (!empty($this->uniqueKeys)) + { + $keys[] = implode(', ', $this->uniqueKeys); + } + + if (!empty($this->keys)) + { + $keys[] = implode(', ', $this->keys); + } + + return implode(', ', $keys); + } + + /** + * Function to set the view keys + * + * @param string $column The field column database array values + * + * @return void + * @since 3.2.1 + */ + protected function setKeys(array $column): void + { + $this->setUniqueKey($column); + $this->setKey($column); + } + + /** + * Function to set the unique key + * + * @param string $column The field column database array values + * + * @return void + * @since 3.2.1 + */ + protected function setUniqueKey(array $column): void + { + if (isset($column['unique_key']) && $column['unique_key']) + { + $key = $column['unique_key_name'] ?? $column['name']; + $this->uniqueKeys[] = "UNIQUE KEY `idx_" . $key . "` (`" . $column['name'] . "`)"; + } + } + + /** + * Function to set the key + * + * @param string $column The field column database array values + * + * @return void + * @since 3.2.1 + */ + protected function setKey(array $column): void + { + if (isset($column['key']) && $column['key']) + { + $key = $column['key_name'] ?? $column['name']; + $this->keys[] = "KEY `idx_" . $key . "` (`" . $column['name'] . "`)"; + } + } + + /** + * Adjusts the default value SQL fragment for a database field based on its type and specific rules. + * + * If the field is of type DATETIME and the Joomla version is not 3, it sets the default to CURRENT_TIMESTAMP + * if not explicitly specified otherwise. For all other types, or when a 'EMPTY' default is specified, it handles + * defaults by either leaving them unset or applying the provided default, properly quoted for SQL safety. + * + * @param string $type The type of the database field (e.g., 'DATETIME'). + * @param string|null $defaultValue Optional default value for the field, null if not provided. + * @param bool $pure Optional to add the 'DEFAULT' string or not. + * + * @return string The SQL fragment to set the default value for a field. + * @since 3.2.1 + */ + protected function getDefaultValue(string $type, ?string $defaultValue, bool $pure = false): string + { + if ($defaultValue === null || strtoupper($defaultValue) === 'EMPTY') + { + return ''; + } + + // Set default for DATETIME fields in Joomla versions above 3 + if (strtoupper($type) === 'DATETIME' && $this->currentVersion != 3) + { + return $pure ? "CURRENT_TIMESTAMP" : " DEFAULT CURRENT_TIMESTAMP"; + } + + // Apply and quote the default value + return $pure ? $defaultValue : " DEFAULT " . $this->db->quote($defaultValue); + } +} + diff --git a/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Interfaces/SchemaInterface.php b/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Interfaces/SchemaInterface.php new file mode 100644 index 0000000..943ab64 --- /dev/null +++ b/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Interfaces/SchemaInterface.php @@ -0,0 +1,53 @@ + + * @git 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 TrueChristianChurch\Joomla\Interfaces; + + +/** + * Schema Checking Interface + * + * @since 3.2.1 + */ +interface SchemaInterface +{ + /** + * Check and update database schema for missing fields or tables. + * + * @return array The array of successful updates/actions, if empty no update/action was taken. + * @since 3.2.1 + * @throws \Exception If there is an error during the update process. + */ + public function update(): array; + + /** + * Create a table with all necessary fields. + * + * @param string $table The name of the table to create. + * + * @return void + * @since 3.2.1 + * @throws \Exception If there is an error creating the table. + */ + public function createTable(string $table): void; + + /** + * Update the schema of an existing table. + * + * @param string $table The table to update. + * + * @return void + * @since 3.2.1 + * @throws \Exception If there is an error while updating the schema. + */ + public function updateSchema(string $table): void; +} + diff --git a/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Interfaces/Tableinterface.php b/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Interfaces/Tableinterface.php index 567dd8f..f584717 100644 --- a/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Interfaces/Tableinterface.php +++ b/libraries/vendor_getbible/TrueChristianChurch.Joomla/src/Interfaces/Tableinterface.php @@ -26,15 +26,16 @@ interface Tableinterface * Example: $this->get('table_name'); * Get all areas/views/tables with all their item/field/column details * Example: $this->get('All'); + * Example: $this->get(); * - * @param string $table The table + * @param string|null $table The table * @param string|null $field The field * @param string|null $key The value key * * @return mixed * @since 3.2.0 */ - public function get(string $table, ?string $field = null, ?string $key = null); + public function get(?string $table = null, ?string $field = null, ?string $key = null); /** * Get title field from an area/view/table @@ -80,10 +81,11 @@ interface Tableinterface * * @param string $table The area * @param bool $default Add the default fields + * @param bool $details Add/Leave fields the details * * @return array|null On success an array of fields * @since 3.2.0 */ - public function fields(string $table, bool $default = false): ?array; + public function fields(string $table, bool $default = false, bool $details = false): ?array; } diff --git a/site/src/Helper/GetbibleHelper.php b/site/src/Helper/GetbibleHelper.php index f71bf15..873df35 100644 --- a/site/src/Helper/GetbibleHelper.php +++ b/site/src/Helper/GetbibleHelper.php @@ -16,53 +16,12 @@ /------------------------------------------------------------------------------------------------------*/ namespace TrueChristianChurch\Component\Getbible\Site\Helper; - - -// register additional namespace -\spl_autoload_register(function ($class) { - // project-specific base directories and namespace prefix - $search = [ - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.GetBible' => 'TrueChristianChurch\\Joomla\\GetBible', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Openai' => 'TrueChristianChurch\\Joomla\\Openai', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Gitea' => 'TrueChristianChurch\\Joomla\\Gitea', - 'libraries/vendor_getbible/TrueChristianChurch.Joomla' => 'TrueChristianChurch\\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 = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; - // if the file exists, require it - if (file_exists($file)) - { - require $file; - } -}); +// The power autoloader for this project (JPATH_SITE) area. +$power_autoloader = JPATH_SITE . '/components/com_getbible/src/Helper/PowerloaderHelper.php'; +if (file_exists($power_autoloader)) +{ + require_once $power_autoloader; +} use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; diff --git a/site/src/Helper/PowerloaderHelper.php b/site/src/Helper/PowerloaderHelper.php new file mode 100644 index 0000000..c039ae3 --- /dev/null +++ b/site/src/Helper/PowerloaderHelper.php @@ -0,0 +1,65 @@ + + @git Get Bible + @github Get Bible + @support Get Bible + @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/TrueChristianChurch.Joomla.GetBible' => 'TrueChristianChurch\\Joomla\\GetBible', + 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Openai' => 'TrueChristianChurch\\Joomla\\Openai', + 'libraries/vendor_getbible/TrueChristianChurch.Joomla.Gitea' => 'TrueChristianChurch\\Joomla\\Gitea', + 'libraries/vendor_getbible/TrueChristianChurch.Joomla' => 'TrueChristianChurch\\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 = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; + // if the file exists, require it + if (file_exists($file)) + { + require $file; + } +}); diff --git a/site/src/Model/AjaxModel.php b/site/src/Model/AjaxModel.php index b99ad23..993bc12 100644 --- a/site/src/Model/AjaxModel.php +++ b/site/src/Model/AjaxModel.php @@ -33,6 +33,7 @@ use Joomla\CMS\Session\Session; use Joomla\CMS\Uri\Uri; use Joomla\Registry\Registry; use TrueChristianChurch\Component\Getbible\Administrator\Helper\GetbibleHelper; +use TrueChristianChurch\Joomla\GetBible\Openai; use TrueChristianChurch\Joomla\GetBible\Factory as GetBibleFactory; use TrueChristianChurch\Joomla\Utilities\JsonHelper; use TrueChristianChurch\Joomla\Utilities\GuidHelper; diff --git a/site/src/Model/OpenaiModel.php b/site/src/Model/OpenaiModel.php index b6033ff..e01e5aa 100644 --- a/site/src/Model/OpenaiModel.php +++ b/site/src/Model/OpenaiModel.php @@ -220,7 +220,7 @@ class OpenaiModel extends ItemModel $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage('The Open AI feature has not been activated. Please contact the system administrator of this website to resolve this.', 'error'); - $app->redirect(\JRoute::_('index.php?option=com_getbible&view=app')); + $app->redirect(Route::_('index.php?option=com_getbible&view=app')); return false; } // validate that we have a valid prompt and we have a book, chapter and verse @@ -229,7 +229,7 @@ class OpenaiModel extends ItemModel $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage('There has been an error!', 'error'); - $app->redirect(\JRoute::_('index.php?option=com_getbible&view=app')); + $app->redirect(Route::_('index.php?option=com_getbible&view=app')); return false; } // validate that we have the correct translation @@ -238,7 +238,7 @@ class OpenaiModel extends ItemModel $app = Factory::getApplication(); // If no data is found redirect to default page and show warning. $app->enqueueMessage('There has been an error: mismatch!', 'error'); - $app->redirect(\JRoute::_('index.php?option=com_getbible&view=app')); + $app->redirect(Route::_('index.php?option=com_getbible&view=app')); return false; } diff --git a/site/tmpl/app/default_getbiblebooks.php b/site/tmpl/app/default_getbiblebooks.php index 5d260ee..c30b4ee 100644 --- a/site/tmpl/app/default_getbiblebooks.php +++ b/site/tmpl/app/default_getbiblebooks.php @@ -18,6 +18,7 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; // No direct access to this file defined('_JEXEC') or die; @@ -28,11 +29,11 @@ defined('_JEXEC') or die;

nr !== $this->chapter->book_nr): ?> - + name; ?> - + name; ?> diff --git a/site/tmpl/app/default_getbiblechapters.php b/site/tmpl/app/default_getbiblechapters.php index 74b8a63..dcfd85b 100644 --- a/site/tmpl/app/default_getbiblechapters.php +++ b/site/tmpl/app/default_getbiblechapters.php @@ -18,6 +18,7 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; // No direct access to this file defined('_JEXEC') or die; @@ -28,11 +29,11 @@ defined('_JEXEC') or die;
chapter !== $this->chapter->chapter): ?> - + chapter; ?> - + chapter; ?> diff --git a/site/tmpl/app/default_getbibletranslations.php b/site/tmpl/app/default_getbibletranslations.php index 5c99851..22aa2e1 100644 --- a/site/tmpl/app/default_getbibletranslations.php +++ b/site/tmpl/app/default_getbibletranslations.php @@ -18,13 +18,14 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Router\Route; // No direct access to this file defined('_JEXEC') or die; ?> defaultTranslation)): ?> - + defaultTranslation->translation; ?> (defaultTranslation->abbreviation; ?>) @@ -39,11 +40,11 @@ defined('_JEXEC') or die;
abbreviation !== $this->chapter->abbreviation): ?> - + translation; ?> (abbreviation; ?>) - + translation; ?> (abbreviation; ?>) diff --git a/update_server.xml b/update_server.xml index c664b4a..39d6e63 100644 --- a/update_server.xml +++ b/update_server.xml @@ -5,10 +5,10 @@ pkg_getbible package site - 3.0.8 + 3.0.9 https://getbible.net - https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.0.8.zip + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.0.9.zip stable @@ -233,4 +233,22 @@ https://getbible.net + + Get Bible + The Bible for Joomla + pkg_getbible + package + site + 4.0.12 + https://getbible.net + + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v4.0.12.zip + + + stable + + Llewellyn van der Merwe + https://getbible.net + + \ No newline at end of file