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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get API hash value
|
try
|
||||||
$hash = $this->chapters->sha($translation, $book, $chapter);
|
{
|
||||||
|
// get API hash value
|
||||||
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all the books
|
try
|
||||||
$chapters = $this->chapters->list($translation, $book);
|
{
|
||||||
|
// get all the books
|
||||||
|
$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,8 +246,15 @@ 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;
|
||||||
|
|
||||||
// get verses from the API
|
try
|
||||||
if (($api = $this->chapters->list($translation, $book)) === null)
|
{
|
||||||
|
// get verses from the API
|
||||||
|
if (($api = $this->chapters->list($translation, $book)) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -312,8 +333,15 @@ final class Chapter extends Watcher
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all the verses
|
try
|
||||||
if (($verses = $this->verses->get($translation, $book, $chapter)) === null)
|
{
|
||||||
|
// get all the verses
|
||||||
|
if (($verses = $this->verses->get($translation, $book, $chapter)) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -345,8 +373,15 @@ 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;
|
||||||
|
|
||||||
// get verses from the API
|
try
|
||||||
if (($api = $this->verses->get($translation, $book, $chapter)) === null)
|
{
|
||||||
|
// get verses from the API
|
||||||
|
if (($api = $this->verses->get($translation, $book, $chapter)) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,15 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get API hash value
|
try
|
||||||
$hash = $this->chapters->sha($translation, $book, $chapter);
|
{
|
||||||
|
// get API hash value
|
||||||
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all the books
|
try
|
||||||
$chapters = $this->chapters->list($translation, $book);
|
{
|
||||||
|
// get all the books
|
||||||
|
$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,8 +217,15 @@
|
|||||||
// load all the verses from the local database
|
// load all the verses from the local database
|
||||||
$inserted = false;
|
$inserted = false;
|
||||||
|
|
||||||
// get verses from the API
|
try
|
||||||
if (($api = $this->chapters->list($translation, $book)) === null)
|
{
|
||||||
|
// get verses from the API
|
||||||
|
if (($api = $this->chapters->list($translation, $book)) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -283,8 +304,15 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all the verses
|
try
|
||||||
if (($verses = $this->verses->get($translation, $book, $chapter)) === null)
|
{
|
||||||
|
// get all the verses
|
||||||
|
if (($verses = $this->verses->get($translation, $book, $chapter)) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -316,8 +344,15 @@
|
|||||||
// load all the verses from the local database
|
// load all the verses from the local database
|
||||||
$inserted = false;
|
$inserted = false;
|
||||||
|
|
||||||
// get verses from the API
|
try
|
||||||
if (($api = $this->verses->get($translation, $book, $chapter)) === null)
|
{
|
||||||
|
// get verses from the API
|
||||||
|
if (($api = $this->verses->get($translation, $book, $chapter)) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,15 @@ final class Translation extends Watcher
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get API hash value
|
try
|
||||||
$hash = $this->translations->sha($translation);
|
{
|
||||||
|
// get API hash value
|
||||||
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all the translations
|
try
|
||||||
$translations = $this->translations->list();
|
{
|
||||||
|
// get all the translations
|
||||||
|
$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))
|
||||||
@ -150,8 +164,15 @@ final class Translation extends Watcher
|
|||||||
*/
|
*/
|
||||||
private function update(): bool
|
private function update(): bool
|
||||||
{
|
{
|
||||||
// get translations from the API
|
try
|
||||||
if (($translations = $this->translations->list()) === null)
|
{
|
||||||
|
// get translations from the API
|
||||||
|
if (($translations = $this->translations->list()) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,15 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get API hash value
|
try
|
||||||
$hash = $this->translations->sha($translation);
|
{
|
||||||
|
// get API hash value
|
||||||
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all the translations
|
try
|
||||||
$translations = $this->translations->list();
|
{
|
||||||
|
// get all the translations
|
||||||
|
$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))
|
||||||
@ -122,8 +136,15 @@
|
|||||||
*/
|
*/
|
||||||
private function update(): bool
|
private function update(): bool
|
||||||
{
|
{
|
||||||
// get translations from the API
|
try
|
||||||
if (($translations = $this->translations->list()) === null)
|
{
|
||||||
|
// get translations from the API
|
||||||
|
if (($translations = $this->translations->list()) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -104,8 +104,15 @@ final class Book extends Watcher
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get API hash value
|
try
|
||||||
$hash = $this->books->sha($translation, $book);
|
{
|
||||||
|
// get API hash value
|
||||||
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all this translation books
|
try
|
||||||
$books = $this->books->list($translation);
|
{
|
||||||
|
// get all this translation books
|
||||||
|
$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))
|
||||||
@ -169,8 +183,15 @@ final class Book extends Watcher
|
|||||||
*/
|
*/
|
||||||
private function update(string $translation): bool
|
private function update(string $translation): bool
|
||||||
{
|
{
|
||||||
// get translations from the API
|
try
|
||||||
if (($books = $this->books->list($translation)) === null)
|
{
|
||||||
|
// get translations from the API
|
||||||
|
if (($books = $this->books->list($translation)) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,15 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get API hash value
|
try
|
||||||
$hash = $this->books->sha($translation, $book);
|
{
|
||||||
|
// get API hash value
|
||||||
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all this translation books
|
try
|
||||||
$books = $this->books->list($translation);
|
{
|
||||||
|
// get all this translation books
|
||||||
|
$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))
|
||||||
@ -141,8 +155,15 @@
|
|||||||
*/
|
*/
|
||||||
private function update(string $translation): bool
|
private function update(string $translation): bool
|
||||||
{
|
{
|
||||||
// get translations from the API
|
try
|
||||||
if (($books = $this->books->list($translation)) === null)
|
{
|
||||||
|
// get translations from the API
|
||||||
|
if (($books = $this->books->list($translation)) === null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user