From 351e91b47331e98f52349fe1a18531f537c19d6c Mon Sep 17 00:00:00 2001 From: aB0t Date: Tue, 1 Aug 2023 07:29:00 +0200 Subject: [PATCH] Stable release of v2.0.7 Adds force update option. Improves the book name display on Bible page. --- CHANGELOG.md | 7 +- README.md | 12 +-- admin/README.txt | 12 +-- admin/sql/updates/mysql/2.0.6.sql | 1 + getbible.xml | 4 +- .../src/Abstraction/Watcher.php | 25 ++++++ .../VDM.Joomla.GetBible/src/Watcher.php | 25 +++++- script.php | 2 +- site/controllers/ajax.json.php | 3 +- site/models/ajax.php | 8 +- site/models/app.php | 88 ++++++++++++------- site/views/app/view.html.php | 20 +++-- update_server.xml | 18 ++++ 13 files changed, 167 insertions(+), 58 deletions(-) create mode 100644 admin/sql/updates/mysql/2.0.6.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index f45613d..18e8026 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,4 +35,9 @@ - Adds updating watchers for book names, and translation details. - Adds edit option to owned tags - Better session management that allows sharing sessions. -- Few bug fixes \ No newline at end of file +- Few bug fixes + +# v2.0.7 + +- Adds force update option +- Improves the book name display on Bible page \ No newline at end of file diff --git a/README.md b/README.md index 622c9f8..b55f79b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (2.0.6) +# Get Bible (2.0.7) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -19,20 +19,20 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 + *Last Build*: 1st August, 2023 -+ *Version*: 2.0.6 ++ *Version*: 2.0.7 + *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 -**543 Hours** or **68 Eight Hour Days** (actual time the author saved - +**544 Hours** or **68 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*: **194656** -+ *File count*: **1697** ++ *Line count*: **194879** ++ *File count*: **1698** + *Folder count*: **162** **359 Hours** or **45 Eight Hour Days** (the actual time the author spent) @@ -43,7 +43,7 @@ due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > **mapping @54hours** = codingtime / 10; > **office @91hours** = codingtime / 6;) -**902 Hours** or **113 Eight Hour Days** +**903 Hours** or **113 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**, diff --git a/admin/README.txt b/admin/README.txt index 622c9f8..b55f79b 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (2.0.6) +# Get Bible (2.0.7) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -19,20 +19,20 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 + *Last Build*: 1st August, 2023 -+ *Version*: 2.0.6 ++ *Version*: 2.0.7 + *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 -**543 Hours** or **68 Eight Hour Days** (actual time the author saved - +**544 Hours** or **68 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*: **194656** -+ *File count*: **1697** ++ *Line count*: **194879** ++ *File count*: **1698** + *Folder count*: **162** **359 Hours** or **45 Eight Hour Days** (the actual time the author spent) @@ -43,7 +43,7 @@ due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > **mapping @54hours** = codingtime / 10; > **office @91hours** = codingtime / 6;) -**902 Hours** or **113 Eight Hour Days** +**903 Hours** or **113 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**, diff --git a/admin/sql/updates/mysql/2.0.6.sql b/admin/sql/updates/mysql/2.0.6.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/admin/sql/updates/mysql/2.0.6.sql @@ -0,0 +1 @@ + diff --git a/getbible.xml b/getbible.xml index 7a448b0..ca4141e 100644 --- a/getbible.xml +++ b/getbible.xml @@ -7,9 +7,9 @@ https://getbible.net Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 2.0.6 + 2.0.7 Get Bible (v.2.0.6) +

Get Bible (v.2.0.7)

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/jcb_powers/VDM.Joomla.GetBible/src/Abstraction/Watcher.php b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Abstraction/Watcher.php index eb9277c..2496e2f 100644 --- a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Abstraction/Watcher.php +++ b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Abstraction/Watcher.php @@ -57,6 +57,14 @@ abstract class Watcher */ protected bool $fresh = false; + /** + * The force update + * + * @var bool + * @since 2.0.1 + */ + protected bool $force = false; + /** * The target * @@ -95,6 +103,17 @@ abstract class Watcher $this->today = (new Date())->toSql(); } + /** + * The switch to force a local update + * + * @return void + * @since 2.0.1 + */ + public function forceUpdate(): void + { + $this->force = true; + } + /** * The see if new target is newly installed * @@ -114,6 +133,12 @@ abstract class Watcher */ protected function hold(): bool { + // if we are being forced + if ($this->force) + { + return false; // we no longer hold, but force an update + } + // Create DateTime objects from the strings try { $today = new \DateTime($this->today); diff --git a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Watcher.php b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Watcher.php index b1e7f4f..c88f4e2 100644 --- a/libraries/jcb_powers/VDM.Joomla.GetBible/src/Watcher.php +++ b/libraries/jcb_powers/VDM.Joomla.GetBible/src/Watcher.php @@ -93,12 +93,16 @@ final class Watcher * @param string $translation The translation. * @param int $book The book number. * @param int $chapter The chapter number. + * @param bool $force The switch to force an update. * * @return bool True on success * @since 2.0.1 */ - public function sync(string $translation, int $book, int $chapter): bool + public function sync(string $translation, int $book, int $chapter, bool $force = false): bool { + // set the update state + $this->forceUpdate($force); + // is the translation details in sync if (!$this->translation->sync($translation)) { @@ -315,6 +319,25 @@ final class Watcher } return $this->getPreviousBook($translation, $previous, $try); + } + + /** + * The method to set the update state + * + * @param bool $state The switch to force an update. + * + * @return void + * @since 2.0.1 + */ + private function forceUpdate(bool $state): void + { + // force all updates + if ($state) + { + $this->translation->forceUpdate(); + $this->book->forceUpdate(); + $this->chapter->forceUpdate(); + } } } diff --git a/script.php b/script.php index 657579f..28c0969 100644 --- a/script.php +++ b/script.php @@ -1539,7 +1539,7 @@ class com_getbibleInstallerScript echo ' -

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

'; +

Upgrade to Version 2.0.7 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/controllers/ajax.json.php b/site/controllers/ajax.json.php index 7aca6ad..4237774 100644 --- a/site/controllers/ajax.json.php +++ b/site/controllers/ajax.json.php @@ -167,9 +167,10 @@ class GetbibleControllerAjax extends BaseController $translationValue = $jinput->get('translation', null, 'ALNUM'); $bookValue = $jinput->get('book', null, 'INT'); $chapterValue = $jinput->get('chapter', null, 'INT'); + $forceValue = $jinput->get('force', 0, 'INT'); if($translationValue && $bookValue && $chapterValue) { - $result = $this->getModel('ajax')->installBibleChapter($translationValue, $bookValue, $chapterValue); + $result = $this->getModel('ajax')->installBibleChapter($translationValue, $bookValue, $chapterValue, $forceValue); } else { diff --git a/site/models/ajax.php b/site/models/ajax.php index ab6bf59..b7eaa3e 100644 --- a/site/models/ajax.php +++ b/site/models/ajax.php @@ -95,20 +95,22 @@ class GetbibleModelAjax extends ListModel } /** - * Load the given chapter of the Bible into the database + * Load the given chapter of the Bible into the database, or force an update * * @param string $translation The translation abbreviation * @param int $book The book number * @param int $chapter The chapter number + * @param int $force The switch to force an update * * @return array|null * @since 3.2.0 **/ - public function installBibleChapter(string $translation, int $book, int $chapter): ?array + public function installBibleChapter(string $translation, int $book, int $chapter, int $force = 0): ?array { try { - Factory::_('GetBible.Watcher')->sync($translation, $book, $chapter); + $_force = ($force == 1) ? true:false; + Factory::_('GetBible.Watcher')->sync($translation, $book, $chapter, $_force); } catch(Exception $error) { diff --git a/site/models/app.php b/site/models/app.php index c7d2418..590dd41 100644 --- a/site/models/app.php +++ b/site/models/app.php @@ -278,20 +278,6 @@ class GetbibleModelApp extends ItemModel array('c.name'), array('book_name'))); $query->join('LEFT', ($db->quoteName('#__getbible_book', 'c')) . ' ON (' . $db->quoteName('a.book_nr') . ' = ' . $db->quoteName('c.nr') . ')'); - // Check if $this->translation is a string or numeric value. - $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) - { - $query->where('a.abbreviation = ' . $db->quote($checkValue)); - } - elseif (is_numeric($checkValue)) - { - $query->where('a.abbreviation = ' . $checkValue); - } - else - { - return false; - } // Check if $this->book is a string or numeric value. $checkValue = $this->book; if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) @@ -320,10 +306,48 @@ class GetbibleModelApp extends ItemModel { return false; } - // Get where b.abbreviation is a.abbreviation - $query->where('b.abbreviation = a.abbreviation'); - // Get where c.abbreviation is a.abbreviation - $query->where('c.abbreviation = a.abbreviation'); + // Check if $this->translation is a string or numeric value. + $checkValue = $this->translation; + if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + { + $query->where('a.abbreviation = ' . $db->quote($checkValue)); + } + elseif (is_numeric($checkValue)) + { + $query->where('a.abbreviation = ' . $checkValue); + } + else + { + return false; + } + // Check if $this->translation is a string or numeric value. + $checkValue = $this->translation; + if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + { + $query->where('c.abbreviation = ' . $db->quote($checkValue)); + } + elseif (is_numeric($checkValue)) + { + $query->where('c.abbreviation = ' . $checkValue); + } + else + { + return false; + } + // Check if $this->translation is a string or numeric value. + $checkValue = $this->translation; + if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + { + $query->where('a.abbreviation = ' . $db->quote($checkValue)); + } + elseif (is_numeric($checkValue)) + { + $query->where('a.abbreviation = ' . $checkValue); + } + else + { + return false; + } // Reset the query using our newly populated query object. $db->setQuery($query); @@ -372,20 +396,6 @@ class GetbibleModelApp extends ItemModel array('name','book_nr','chapter','verse','text'))); $query->from($db->quoteName('#__getbible_verse', 'v')); $query->where('v.chapter = ' . $db->quote($chapter)); - // Check if $this->translation is a string or numeric value. - $checkValue = $this->translation; - if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) - { - $query->where('v.abbreviation = ' . $db->quote($checkValue)); - } - elseif (is_numeric($checkValue)) - { - $query->where('v.abbreviation = ' . $checkValue); - } - else - { - return false; - } // Check if $this->book is a string or numeric value. $checkValue = $this->book; if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) @@ -400,6 +410,20 @@ class GetbibleModelApp extends ItemModel { return false; } + // Check if $this->translation is a string or numeric value. + $checkValue = $this->translation; + if (isset($checkValue) && GetbibleHelper::checkString($checkValue)) + { + $query->where('v.abbreviation = ' . $db->quote($checkValue)); + } + elseif (is_numeric($checkValue)) + { + $query->where('v.abbreviation = ' . $checkValue); + } + else + { + return false; + } // Reset the query using our newly populated query object. $db->setQuery($query); diff --git a/site/views/app/view.html.php b/site/views/app/view.html.php index b4940b2..2638c30 100644 --- a/site/views/app/view.html.php +++ b/site/views/app/view.html.php @@ -755,11 +755,21 @@ class GetbibleViewApp extends HtmlView return UrlAjax + 'removeTagFromVerse&tag=' + tag; }; - const installBibleChapterURL = (translation, book, chapter) => { - // build load Bible url - return UrlAjax + 'installBibleChapter&translation=' + translation + - '&book=' + book + '&chapter=' + chapter; - }; + const installBibleChapterURL = (() => { + let isFirstCall = true; + return (translation, book, chapter) => { + // build load Bible url + let url = UrlAjax + 'installBibleChapter&translation=' + translation + + '&book=' + book + '&chapter=' + chapter; + // Append \"&force=1\" if it is the first call + if (isFirstCall) { + url += '&force=1'; + isFirstCall = false; + } + + return url; + }; + })(); const getLinkersDisplayURL = () => { // build load Bible url return UrlAjax + 'getLinkersDisplay'; diff --git a/update_server.xml b/update_server.xml index 1f00faa..b816806 100644 --- a/update_server.xml +++ b/update_server.xml @@ -107,4 +107,22 @@ https://getbible.net + + Get Bible + The Bible for Joomla + pkg_getbible + component + site + 2.0.7 + https://getbible.net + + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v2.0.7.zip + + + stable + + Llewellyn van der Merwe + https://getbible.net + + \ No newline at end of file