update 2023-07-02 09:34:21
This commit is contained in:
parent
775786ed42
commit
8820489aca
@ -22,6 +22,7 @@ class Watcher << (F,LightGreen) >> #Green {
|
|||||||
# string $today
|
# string $today
|
||||||
# ?object $verse
|
# ?object $verse
|
||||||
+ __construct(Load $load, Insert $insert, ...)
|
+ __construct(Load $load, Insert $insert, ...)
|
||||||
|
+ isNew() : bool
|
||||||
+ api(string $translation, int $book, ...) : bool
|
+ api(string $translation, int $book, ...) : bool
|
||||||
+ getNextChapter(string $translation, int $book, ...) : ?int
|
+ getNextChapter(string $translation, int $book, ...) : ?int
|
||||||
+ getPreviousChapter(int $chapter, bool $force = false) : ?int
|
+ getPreviousChapter(int $chapter, bool $force = false) : ?int
|
||||||
@ -54,7 +55,14 @@ note right of Watcher::__construct
|
|||||||
Verses $verses
|
Verses $verses
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Watcher::api
|
note left of Watcher::isNew
|
||||||
|
The see if new chapters was installed, and therefore new
|
||||||
|
|
||||||
|
since: 2.0.1
|
||||||
|
return: bool
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Watcher::api
|
||||||
Watching that the local Database and API is in sync
|
Watching that the local Database and API is in sync
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
@ -66,7 +74,7 @@ note left of Watcher::api
|
|||||||
int $chapter
|
int $chapter
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Watcher::getNextChapter
|
note left of Watcher::getNextChapter
|
||||||
Get the next chapter
|
Get the next chapter
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
@ -79,21 +87,21 @@ note right of Watcher::getNextChapter
|
|||||||
bool $force = false
|
bool $force = false
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Watcher::getPreviousChapter
|
note right of Watcher::getPreviousChapter
|
||||||
Get the previous chapter
|
Get the previous chapter
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
return: ?int
|
return: ?int
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Watcher::getLastChapter
|
note left of Watcher::getLastChapter
|
||||||
Get the last chapter of a book
|
Get the last chapter of a book
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
return: ?int
|
return: ?int
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Watcher::getNextBook
|
note right of Watcher::getNextBook
|
||||||
Get the next book
|
Get the next book
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
@ -105,7 +113,7 @@ note left of Watcher::getNextBook
|
|||||||
int $try
|
int $try
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Watcher::getPreviousBook
|
note left of Watcher::getPreviousBook
|
||||||
Get the previous book
|
Get the previous book
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
@ -117,21 +125,21 @@ note right of Watcher::getPreviousBook
|
|||||||
int $try
|
int $try
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Watcher::translation
|
note right of Watcher::translation
|
||||||
Get Translation Hash Value
|
Get Translation Hash Value
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
return: ?string
|
return: ?string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Watcher::book
|
note left of Watcher::book
|
||||||
Get Book Hash Value
|
Get Book Hash Value
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
return: ?string
|
return: ?string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Watcher::chapter
|
note right of Watcher::chapter
|
||||||
Get Chapter Hash Value
|
Get Chapter Hash Value
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
@ -143,7 +151,7 @@ note left of Watcher::chapter
|
|||||||
int $chapter
|
int $chapter
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Watcher::verses
|
note left of Watcher::verses
|
||||||
Load verses if not in local database
|
Load verses if not in local database
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
@ -155,7 +163,7 @@ note right of Watcher::verses
|
|||||||
int $chapter
|
int $chapter
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Watcher::update
|
note right of Watcher::update
|
||||||
Trigger the update of the verses of a translation-book-chapter
|
Trigger the update of the verses of a translation-book-chapter
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
@ -167,14 +175,14 @@ note left of Watcher::update
|
|||||||
int $chapter
|
int $chapter
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Watcher::getVerse
|
note left of Watcher::getVerse
|
||||||
Get a verse text from the API array of verses
|
Get a verse text from the API array of verses
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
return: ?object
|
return: ?object
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Watcher::updateHash
|
note right of Watcher::updateHash
|
||||||
Trigger the update of a chapter hash value
|
Trigger the update of a chapter hash value
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
@ -187,14 +195,14 @@ note left of Watcher::updateHash
|
|||||||
string $hash
|
string $hash
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Watcher::hold
|
note left of Watcher::hold
|
||||||
Check if its time to match the API hash
|
Check if its time to match the API hash
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
return: bool
|
return: bool
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Watcher::bump
|
note right of Watcher::bump
|
||||||
Bump the checking time
|
Bump the checking time
|
||||||
|
|
||||||
since: 2.0.1
|
since: 2.0.1
|
||||||
|
@ -143,6 +143,17 @@ final class Watcher
|
|||||||
$this->today = (new Date())->toSql();
|
$this->today = (new Date())->toSql();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The see if new chapters was installed, and therefore new
|
||||||
|
*
|
||||||
|
* @return bool true if is new
|
||||||
|
* @since 2.0.1
|
||||||
|
*/
|
||||||
|
public function isNew(): bool
|
||||||
|
{
|
||||||
|
return $this->fresh;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watching that the local Database and API is in sync
|
* Watching that the local Database and API is in sync
|
||||||
*
|
*
|
||||||
@ -176,7 +187,7 @@ final class Watcher
|
|||||||
// load the verses if not found
|
// load the verses if not found
|
||||||
if ($this->verses($translation, $book, $chapter))
|
if ($this->verses($translation, $book, $chapter))
|
||||||
{
|
{
|
||||||
if ($this->fresh || $this->hold())
|
if ($this->isNew() || $this->hold())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -216,7 +227,7 @@ final class Watcher
|
|||||||
// we load the next chapter
|
// we load the next chapter
|
||||||
$next = $chapter + 1;
|
$next = $chapter + 1;
|
||||||
// check if this books has this next chapter
|
// check if this books has this next chapter
|
||||||
if (($force || !$this->fresh) && $this->load->value(
|
if (($force || !$this->isNew()) && $this->load->value(
|
||||||
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $next],
|
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $next],
|
||||||
'sha', 'chapter'
|
'sha', 'chapter'
|
||||||
))
|
))
|
||||||
@ -240,7 +251,7 @@ final class Watcher
|
|||||||
{
|
{
|
||||||
// we load the previous chapter
|
// we load the previous chapter
|
||||||
$previous = $chapter - 1;
|
$previous = $chapter - 1;
|
||||||
if (($force || !$this->fresh) && $previous > 0)
|
if (($force || !$this->isNew()) && $previous > 0)
|
||||||
{
|
{
|
||||||
return $previous;
|
return $previous;
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,17 @@
|
|||||||
$this->today = (new Date())->toSql();
|
$this->today = (new Date())->toSql();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The see if new chapters was installed, and therefore new
|
||||||
|
*
|
||||||
|
* @return bool true if is new
|
||||||
|
* @since 2.0.1
|
||||||
|
*/
|
||||||
|
public function isNew(): bool
|
||||||
|
{
|
||||||
|
return $this->fresh;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watching that the local Database and API is in sync
|
* Watching that the local Database and API is in sync
|
||||||
*
|
*
|
||||||
@ -145,7 +156,7 @@
|
|||||||
// load the verses if not found
|
// load the verses if not found
|
||||||
if ($this->verses($translation, $book, $chapter))
|
if ($this->verses($translation, $book, $chapter))
|
||||||
{
|
{
|
||||||
if ($this->fresh || $this->hold())
|
if ($this->isNew() || $this->hold())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -185,7 +196,7 @@
|
|||||||
// we load the next chapter
|
// we load the next chapter
|
||||||
$next = $chapter + 1;
|
$next = $chapter + 1;
|
||||||
// check if this books has this next chapter
|
// check if this books has this next chapter
|
||||||
if (($force || !$this->fresh) && $this->load->value(
|
if (($force || !$this->isNew()) && $this->load->value(
|
||||||
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $next],
|
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $next],
|
||||||
'sha', 'chapter'
|
'sha', 'chapter'
|
||||||
))
|
))
|
||||||
@ -209,7 +220,7 @@
|
|||||||
{
|
{
|
||||||
// we load the previous chapter
|
// we load the previous chapter
|
||||||
$previous = $chapter - 1;
|
$previous = $chapter - 1;
|
||||||
if (($force || !$this->fresh) && $previous > 0)
|
if (($force || !$this->isNew()) && $previous > 0)
|
||||||
{
|
{
|
||||||
return $previous;
|
return $previous;
|
||||||
}
|
}
|
||||||
|
@ -51,15 +51,6 @@ class Table extends BaseTable implements Tableinterface
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
'note' => [
|
'note' => [
|
||||||
'linker' => [
|
|
||||||
'name' => 'linker',
|
|
||||||
'label' => 'COM_GETBIBLE_NOTE_LINKER_LABEL',
|
|
||||||
'type' => 'linkers',
|
|
||||||
'title' => false,
|
|
||||||
'list' => 'notes',
|
|
||||||
'store' => NULL,
|
|
||||||
'tab_name' => 'Details',
|
|
||||||
],
|
|
||||||
'book_nr' => [
|
'book_nr' => [
|
||||||
'name' => 'book_nr',
|
'name' => 'book_nr',
|
||||||
'label' => 'COM_GETBIBLE_NOTE_BOOK_NR_LABEL',
|
'label' => 'COM_GETBIBLE_NOTE_BOOK_NR_LABEL',
|
||||||
@ -69,19 +60,10 @@ class Table extends BaseTable implements Tableinterface
|
|||||||
'store' => NULL,
|
'store' => NULL,
|
||||||
'tab_name' => 'Details',
|
'tab_name' => 'Details',
|
||||||
],
|
],
|
||||||
'chapter' => [
|
'linker' => [
|
||||||
'name' => 'chapter',
|
'name' => 'linker',
|
||||||
'label' => 'COM_GETBIBLE_NOTE_CHAPTER_LABEL',
|
'label' => 'COM_GETBIBLE_NOTE_LINKER_LABEL',
|
||||||
'type' => 'number',
|
'type' => 'linkers',
|
||||||
'title' => false,
|
|
||||||
'list' => 'notes',
|
|
||||||
'store' => NULL,
|
|
||||||
'tab_name' => 'Details',
|
|
||||||
],
|
|
||||||
'verse' => [
|
|
||||||
'name' => 'verse',
|
|
||||||
'label' => 'COM_GETBIBLE_NOTE_VERSE_LABEL',
|
|
||||||
'type' => 'number',
|
|
||||||
'title' => false,
|
'title' => false,
|
||||||
'list' => 'notes',
|
'list' => 'notes',
|
||||||
'store' => NULL,
|
'store' => NULL,
|
||||||
@ -114,13 +96,40 @@ class Table extends BaseTable implements Tableinterface
|
|||||||
'store' => NULL,
|
'store' => NULL,
|
||||||
'tab_name' => 'Details',
|
'tab_name' => 'Details',
|
||||||
],
|
],
|
||||||
|
'verse' => [
|
||||||
|
'name' => 'verse',
|
||||||
|
'label' => 'COM_GETBIBLE_NOTE_VERSE_LABEL',
|
||||||
|
'type' => 'number',
|
||||||
|
'title' => false,
|
||||||
|
'list' => 'notes',
|
||||||
|
'store' => NULL,
|
||||||
|
'tab_name' => 'Details',
|
||||||
|
],
|
||||||
|
'chapter' => [
|
||||||
|
'name' => 'chapter',
|
||||||
|
'label' => 'COM_GETBIBLE_NOTE_CHAPTER_LABEL',
|
||||||
|
'type' => 'number',
|
||||||
|
'title' => false,
|
||||||
|
'list' => 'notes',
|
||||||
|
'store' => NULL,
|
||||||
|
'tab_name' => 'Details',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'taged_verse' => [
|
'taged_verse' => [
|
||||||
|
'book_nr' => [
|
||||||
|
'name' => 'book_nr',
|
||||||
|
'label' => 'COM_GETBIBLE_TAGED_VERSE_BOOK_NR_LABEL',
|
||||||
|
'type' => 'number',
|
||||||
|
'title' => false,
|
||||||
|
'list' => 'taged_verses',
|
||||||
|
'store' => NULL,
|
||||||
|
'tab_name' => 'Details',
|
||||||
|
],
|
||||||
'abbreviation' => [
|
'abbreviation' => [
|
||||||
'name' => 'abbreviation',
|
'name' => 'abbreviation',
|
||||||
'label' => 'COM_GETBIBLE_TAGED_VERSE_ABBREVIATION_LABEL',
|
'label' => 'COM_GETBIBLE_TAGED_VERSE_ABBREVIATION_LABEL',
|
||||||
'type' => 'translations',
|
'type' => 'translations',
|
||||||
'title' => true,
|
'title' => false,
|
||||||
'list' => 'taged_verses',
|
'list' => 'taged_verses',
|
||||||
'store' => NULL,
|
'store' => NULL,
|
||||||
'tab_name' => 'Details',
|
'tab_name' => 'Details',
|
||||||
@ -179,15 +188,6 @@ class Table extends BaseTable implements Tableinterface
|
|||||||
'store' => NULL,
|
'store' => NULL,
|
||||||
'tab_name' => 'Details',
|
'tab_name' => 'Details',
|
||||||
],
|
],
|
||||||
'book_nr' => [
|
|
||||||
'name' => 'book_nr',
|
|
||||||
'label' => 'COM_GETBIBLE_TAGED_VERSE_BOOK_NR_LABEL',
|
|
||||||
'type' => 'number',
|
|
||||||
'title' => false,
|
|
||||||
'list' => 'taged_verses',
|
|
||||||
'store' => NULL,
|
|
||||||
'tab_name' => 'Details',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
'tag' => [
|
'tag' => [
|
||||||
'name' => [
|
'name' => [
|
||||||
|
Loading…
Reference in New Issue
Block a user