diff --git a/CHANGELOG.md b/CHANGELOG.md index 45b6cda..42e0873 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v3.0.3 + +- Add option to target mysql 8+ with the search regex. + # v3.0.2 - More namespace updates. diff --git a/README.md b/README.md index 8490f4f..117292c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (3.0.2) +# Get Bible (3.0.3) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,8 +18,8 @@ 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*: 10th February, 2024 -+ *Version*: 3.0.2 ++ *Last Build*: 18th February, 2024 ++ *Version*: 3.0.3 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -31,8 +31,8 @@ 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*: **201645** -+ *File count*: **1714** ++ *Line count*: **201717** ++ *File count*: **1715** + *Folder count*: **150** **371 Hours** or **47 Eight Hour Days** (the actual time the author spent) diff --git a/admin/README.txt b/admin/README.txt index 8490f4f..117292c 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (3.0.2) +# Get Bible (3.0.3) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,8 +18,8 @@ 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*: 10th February, 2024 -+ *Version*: 3.0.2 ++ *Last Build*: 18th February, 2024 ++ *Version*: 3.0.3 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -31,8 +31,8 @@ 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*: **201645** -+ *File count*: **1714** ++ *Line count*: **201717** ++ *File count*: **1715** + *Folder count*: **150** **371 Hours** or **47 Eight Hour Days** (the actual time the author spent) diff --git a/admin/sql/updates/mysql/3.0.2.sql b/admin/sql/updates/mysql/3.0.2.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/admin/sql/updates/mysql/3.0.2.sql @@ -0,0 +1 @@ + diff --git a/admin/views/book/tmpl/edit.php b/admin/views/book/tmpl/edit.php index 2b2be57..0758f7d 100644 --- a/admin/views/book/tmpl/edit.php +++ b/admin/views/book/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/chapter/tmpl/edit.php b/admin/views/chapter/tmpl/edit.php index 0ff856d..0038d65 100644 --- a/admin/views/chapter/tmpl/edit.php +++ b/admin/views/chapter/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/linker/tmpl/edit.php b/admin/views/linker/tmpl/edit.php index e04b486..7f6ee42 100644 --- a/admin/views/linker/tmpl/edit.php +++ b/admin/views/linker/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/note/tmpl/edit.php b/admin/views/note/tmpl/edit.php index 500a98f..524f8f7 100644 --- a/admin/views/note/tmpl/edit.php +++ b/admin/views/note/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/open_ai_message/tmpl/edit.php b/admin/views/open_ai_message/tmpl/edit.php index 2a1a981..fb06290 100644 --- a/admin/views/open_ai_message/tmpl/edit.php +++ b/admin/views/open_ai_message/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'message')); ?> + 'message', 'recall' => true]); ?>
diff --git a/admin/views/open_ai_response/tmpl/edit.php b/admin/views/open_ai_response/tmpl/edit.php index 84b5158..af5cb21 100644 --- a/admin/views/open_ai_response/tmpl/edit.php +++ b/admin/views/open_ai_response/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/password/tmpl/edit.php b/admin/views/password/tmpl/edit.php index 1e68aaa..3b552f8 100644 --- a/admin/views/password/tmpl/edit.php +++ b/admin/views/password/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/prompt/tmpl/edit.php b/admin/views/prompt/tmpl/edit.php index 929f2a1..99a959b 100644 --- a/admin/views/prompt/tmpl/edit.php +++ b/admin/views/prompt/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'prompt')); ?> + 'prompt', 'recall' => true]); ?>
diff --git a/admin/views/tag/tmpl/edit.php b/admin/views/tag/tmpl/edit.php index e44f39f..923a5ce 100644 --- a/admin/views/tag/tmpl/edit.php +++ b/admin/views/tag/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/tagged_verse/tmpl/edit.php b/admin/views/tagged_verse/tmpl/edit.php index a2ca34f..47b9773 100644 --- a/admin/views/tagged_verse/tmpl/edit.php +++ b/admin/views/tagged_verse/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/translation/tmpl/edit.php b/admin/views/translation/tmpl/edit.php index 796fd21..5baec13 100644 --- a/admin/views/translation/tmpl/edit.php +++ b/admin/views/translation/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/admin/views/verse/tmpl/edit.php b/admin/views/verse/tmpl/edit.php index 7fae5c6..18e3b77 100644 --- a/admin/views/verse/tmpl/edit.php +++ b/admin/views/verse/tmpl/edit.php @@ -51,7 +51,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
- 'details')); ?> + 'details', 'recall' => true]); ?>
diff --git a/getbible.xml b/getbible.xml index b3085df..011ef2e 100644 --- a/getbible.xml +++ b/getbible.xml @@ -1,15 +1,15 @@ COM_GETBIBLE - 10th February, 2024 + 18th February, 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 - 3.0.2 + 3.0.3 Get Bible (v.3.0.2) +

Get Bible (v.3.0.3)

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/script.php b/script.php index 3db70bd..877aaea 100644 --- a/script.php +++ b/script.php @@ -1546,7 +1546,7 @@ class Com_GetbibleInstallerScript echo '

-

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

'; +

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

'; // Set db if not set already. if (!isset($db)) diff --git a/site/models/search.php b/site/models/search.php index a88f4cf..46ad459 100644 --- a/site/models/search.php +++ b/site/models/search.php @@ -397,6 +397,14 @@ class GetbibleModelSearch extends ListModel $conditions = []; $case = $this->case == 2 ? 'BINARY' : ' '; + // Determine the database type and version + $db_type = $this->getDatabaseType($db); // Implement this method based on your environment + $use_modern_regex = $db_type === 'mysql' && $this->isModernMySQL($db); // Implement isModernMySQL to detect MySQL 8+ + + // Adjust REGEXP syntax based on the database type and version + $word_boundary_start = $use_modern_regex ? '\\b' : '[[:<:]]'; + $word_boundary_end = $use_modern_regex ? '\\b' : '[[:>:]]'; + // 2 = ANY WORDS if($this->words == 2) { @@ -436,11 +444,12 @@ class GetbibleModelSearch extends ListModel { if ($i == 0) { - $condition .= $db->quote('[[:<:]]' . $db->escape($word, true). '[[:>:]]'); + $condition .= $db->quote($word_boundary_start . $db->escape($word, true). $word_boundary_end); } else { - $condition .= ' OR ' . $case . ' a.text REGEXP '. $db->quote('[[:<:]]' . $db->escape($word, true) . '[[:>:]]'); + $condition .= ' OR ' . $case . ' a.text REGEXP '. + $db->quote($word_boundary_start . $db->escape($word, true) . $word_boundary_end); } $i++; } @@ -470,7 +479,8 @@ class GetbibleModelSearch extends ListModel { // 1 = exact match // For exact phrase, escape and quote the entire phrase and use REGEXP to match it exactly - $search = $case . ' a.text REGEXP ' . $db->quote('[[:<:]]' . $db->escape($this->search, true) . '[[:>:]]'); + $search = $case . ' a.text REGEXP ' . + $db->quote($word_boundary_start . $db->escape($this->search, true) . $word_boundary_end); $conditions[] = '(' . $search . ')'; } } @@ -498,7 +508,8 @@ class GetbibleModelSearch extends ListModel { if ($this->hasLength($word)) { - $search = $case . ' a.text REGEXP '. $db->quote('[[:<:]]' . $db->escape($word, true) . '[[:>:]]'); + $search = $case . ' a.text REGEXP '. + $db->quote($word_boundary_start . $db->escape($word, true) . $word_boundary_end); $conditions[] = '( ' . $search . ')'; } } @@ -662,5 +673,51 @@ class GetbibleModelSearch extends ListModel protected function hasLength(string $word): bool { return GetBibleFactory::_('GetBible.Utilities.String')->hasLength($word); + } + + /** + * Determines whether the database is MySQL or MariaDB. + * + * This function executes a query to fetch the version comment from the database. + * MariaDB includes its name in the version comment, allowing us to distinguish between MySQL and MariaDB. + * + * @param \JDatabaseDriver $db The database driver object from Joomla. + * + * @return string Returns 'mysql' for MySQL, 'mariadb' for MariaDB, or 'unknown' for other or undetectable types. + */ + protected function getDatabaseType($db): string + { + try { + // Attempt to get the version comment from the database + $versionComment = $db->setQuery("SELECT VERSION()")->loadResult(); + if (strpos(strtolower($versionComment), 'mariadb') !== false) { + return 'mariadb'; + } else { + return 'mysql'; // Assuming MySQL if MariaDB is not detected + } + } catch (\Exception $e) { + // Handle exceptions or fallback for other databases + return 'unknown'; + } + } + + /** + * Checks if the MySQL version is 8.0 or higher. + * + * This function queries the database version directly and compares it against 8.0 + * to determine if modern MySQL features, such as enhanced regular expression syntax, can be used. + * It's specifically designed for MySQL and does not apply to MariaDB or other databases. + * + * @param \JDatabaseDriver $db The database driver object. + * + * @return bool Returns true if the MySQL version is 8.0 or higher, false otherwise. + */ + protected function isModernMySQL($db): bool + { + // Query the database for its version + $version = $db->getVersion(); + + // Compare the version to determine if it's modern MySQL + return version_compare($version, '8.0', '>='); } } diff --git a/site/views/app/tmpl/default.php b/site/views/app/tmpl/default.php index 7fd8797..0a0eadc 100644 --- a/site/views/app/tmpl/default.php +++ b/site/views/app/tmpl/default.php @@ -21,6 +21,7 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; ?> item): ?> diff --git a/site/views/openai/tmpl/default.php b/site/views/openai/tmpl/default.php index f323a58..eccd74d 100644 --- a/site/views/openai/tmpl/default.php +++ b/site/views/openai/tmpl/default.php @@ -21,6 +21,7 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; ?> item): ?> diff --git a/site/views/search/tmpl/default.php b/site/views/search/tmpl/default.php index a3a200b..7343cb7 100644 --- a/site/views/search/tmpl/default.php +++ b/site/views/search/tmpl/default.php @@ -21,6 +21,7 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; ?> params->get('activate_search') == 1): ?> diff --git a/site/views/tag/tmpl/default.php b/site/views/tag/tmpl/default.php index 904f090..25f20ff 100644 --- a/site/views/tag/tmpl/default.php +++ b/site/views/tag/tmpl/default.php @@ -21,6 +21,7 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; +use Joomla\CMS\HTML\HTMLHelper as Html; ?> params->get('activate_tags') == 1): ?> diff --git a/update_server.xml b/update_server.xml index b891c45..7db3841 100644 --- a/update_server.xml +++ b/update_server.xml @@ -593,4 +593,22 @@ https://getbible.net + + Get Bible + The Bible for Joomla + pkg_getbible + package + site + 3.0.3 + https://getbible.net + + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v3.0.3.zip + + + stable + + Llewellyn van der Merwe + https://getbible.net + + \ No newline at end of file