update 2023-11-10 13:08:58
This commit is contained in:
parent
1edf700fdb
commit
b36798318c
@ -92,8 +92,15 @@ final class Chapter extends Watcher
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get API hash value
|
||||
$hash = $this->chapters->sha($translation, $book, $chapter);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// confirm hash has not changed
|
||||
if (hash_equals($hash, $this->target->sha))
|
||||
@ -193,8 +200,15 @@ final class Chapter extends Watcher
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get all the books
|
||||
$chapters = $this->chapters->list($translation, $book);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check return data
|
||||
if (!isset($chapters->{$chapter}) || !isset($chapters->{$chapter}->sha))
|
||||
@ -232,11 +246,18 @@ final class Chapter extends Watcher
|
||||
// load all the verses from the local database
|
||||
$inserted = false;
|
||||
|
||||
try
|
||||
{
|
||||
// get verses from the API
|
||||
if (($api = $this->chapters->list($translation, $book)) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($chapters = $this->load->items(
|
||||
['abbreviation' => $translation, 'book_nr' => $book],
|
||||
@ -312,11 +333,18 @@ final class Chapter extends Watcher
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get all the verses
|
||||
if (($verses = $this->verses->get($translation, $book, $chapter)) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// dynamic update all verse objects
|
||||
$insert = ['book_nr' => $book, 'abbreviation' => $translation];
|
||||
@ -345,11 +373,18 @@ final class Chapter extends Watcher
|
||||
// load all the verses from the local database
|
||||
$inserted = false;
|
||||
|
||||
try
|
||||
{
|
||||
// get verses from the API
|
||||
if (($api = $this->verses->get($translation, $book, $chapter)) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($verses = $this->load->items(
|
||||
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $chapter],
|
||||
|
@ -63,8 +63,15 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get API hash value
|
||||
$hash = $this->chapters->sha($translation, $book, $chapter);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// confirm hash has not changed
|
||||
if (hash_equals($hash, $this->target->sha))
|
||||
@ -164,8 +171,15 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get all the books
|
||||
$chapters = $this->chapters->list($translation, $book);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check return data
|
||||
if (!isset($chapters->{$chapter}) || !isset($chapters->{$chapter}->sha))
|
||||
@ -203,11 +217,18 @@
|
||||
// load all the verses from the local database
|
||||
$inserted = false;
|
||||
|
||||
try
|
||||
{
|
||||
// get verses from the API
|
||||
if (($api = $this->chapters->list($translation, $book)) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($chapters = $this->load->items(
|
||||
['abbreviation' => $translation, 'book_nr' => $book],
|
||||
@ -283,11 +304,18 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get all the verses
|
||||
if (($verses = $this->verses->get($translation, $book, $chapter)) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// dynamic update all verse objects
|
||||
$insert = ['book_nr' => $book, 'abbreviation' => $translation];
|
||||
@ -316,11 +344,18 @@
|
||||
// load all the verses from the local database
|
||||
$inserted = false;
|
||||
|
||||
try
|
||||
{
|
||||
// get verses from the API
|
||||
if (($api = $this->verses->get($translation, $book, $chapter)) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($verses = $this->load->items(
|
||||
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $chapter],
|
||||
|
@ -88,8 +88,15 @@ final class Translation extends Watcher
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get API hash value
|
||||
$hash = $this->translations->sha($translation);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// confirm hash has not changed
|
||||
if (hash_equals($hash, $this->target->sha))
|
||||
@ -122,8 +129,15 @@ final class Translation extends Watcher
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get all the translations
|
||||
$translations = $this->translations->list();
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check return data
|
||||
if (!isset($translations->{$translation}) || !isset($translations->{$translation}->sha))
|
||||
@ -149,12 +163,19 @@ final class Translation extends Watcher
|
||||
* @since 2.0.1
|
||||
*/
|
||||
private function update(): bool
|
||||
{
|
||||
try
|
||||
{
|
||||
// get translations from the API
|
||||
if (($translations = $this->translations->list()) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the local published translations
|
||||
$local_translations = $this->load->items(['published' => 1], $this->table);
|
||||
|
@ -60,8 +60,15 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get API hash value
|
||||
$hash = $this->translations->sha($translation);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// confirm hash has not changed
|
||||
if (hash_equals($hash, $this->target->sha))
|
||||
@ -94,8 +101,15 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get all the translations
|
||||
$translations = $this->translations->list();
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check return data
|
||||
if (!isset($translations->{$translation}) || !isset($translations->{$translation}->sha))
|
||||
@ -121,12 +135,19 @@
|
||||
* @since 2.0.1
|
||||
*/
|
||||
private function update(): bool
|
||||
{
|
||||
try
|
||||
{
|
||||
// get translations from the API
|
||||
if (($translations = $this->translations->list()) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the local published translations
|
||||
$local_translations = $this->load->items(['published' => 1], $this->table);
|
||||
|
@ -104,8 +104,15 @@ final class Book extends Watcher
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get API hash value
|
||||
$hash = $this->books->sha($translation, $book);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// confirm hash has not changed
|
||||
if (hash_equals($hash, $this->target->sha))
|
||||
@ -139,8 +146,15 @@ final class Book extends Watcher
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get all this translation books
|
||||
$books = $this->books->list($translation);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check return data
|
||||
if (!isset($books->{$book}) || !isset($books->{$book}->sha))
|
||||
@ -168,12 +182,19 @@ final class Book extends Watcher
|
||||
* @since 2.0.1
|
||||
*/
|
||||
private function update(string $translation): bool
|
||||
{
|
||||
try
|
||||
{
|
||||
// get translations from the API
|
||||
if (($books = $this->books->list($translation)) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the local books
|
||||
$local_books = $this->load->items(['abbreviation' => $translation], $this->table);
|
||||
|
@ -76,8 +76,15 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get API hash value
|
||||
$hash = $this->books->sha($translation, $book);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// confirm hash has not changed
|
||||
if (hash_equals($hash, $this->target->sha))
|
||||
@ -111,8 +118,15 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get all this translation books
|
||||
$books = $this->books->list($translation);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check return data
|
||||
if (!isset($books->{$book}) || !isset($books->{$book}->sha))
|
||||
@ -140,12 +154,19 @@
|
||||
* @since 2.0.1
|
||||
*/
|
||||
private function update(string $translation): bool
|
||||
{
|
||||
try
|
||||
{
|
||||
// get translations from the API
|
||||
if (($books = $this->books->list($translation)) === null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the local books
|
||||
$local_books = $this->load->items(['abbreviation' => $translation], $this->table);
|
||||
|
Loading…
x
Reference in New Issue
Block a user