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