Stable release of v2.0.7

Adds force update option. Improves the book name display on Bible page.
This commit is contained in:
Robot 2023-08-01 07:29:00 +02:00
parent f6c7352f03
commit 351e91b473
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
13 changed files with 167 additions and 58 deletions

View File

@ -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
- Few bug fixes
# v2.0.7
- Adds force update option
- Improves the book name display on Bible page

View File

@ -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**,

View File

@ -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**,

View File

@ -0,0 +1 @@

View File

@ -7,9 +7,9 @@
<authorUrl>https://getbible.net</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>2.0.6</version>
<version>2.0.7</version>
<description><![CDATA[
<h1>Get Bible (v.2.0.6)</h1>
<h1>Get Bible (v.2.0.7)</h1>
<div style="clear: both;"></div>
<p>Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide.

View File

@ -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);

View File

@ -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();
}
}
}

View File

@ -1539,7 +1539,7 @@ class com_getbibleInstallerScript
echo '<a target="_blank" href="https://getbible.net" title="Get Bible">
<img src="components/com_getbible/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 2.0.6 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 2.0.7 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already.
if (!isset($db))

View File

@ -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
{

View File

@ -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)
{

View File

@ -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);

View File

@ -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';

View File

@ -107,4 +107,22 @@
<maintainerurl>https://getbible.net</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
<update>
<name>Get Bible</name>
<description>The Bible for Joomla</description>
<element>pkg_getbible</element>
<type>component</type>
<client>site</client>
<version>2.0.7</version>
<infourl title="Get Bible!">https://getbible.net</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v2.0.7.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://getbible.net</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
</updates>