Merge remote-tracking branch 'origin/develop'

This commit is contained in:
Timothy Warren 2020-04-28 12:25:35 -04:00
commit 95a7e74d69
19 changed files with 106 additions and 122 deletions

View File

@ -33,7 +33,10 @@ $hasManga = stripos($_SERVER['REQUEST_URI'], 'manga') !== FALSE;
ucfirst($other_type) . ' List' ucfirst($other_type) . ' List'
) ?>] ) ?>]
<?php else: ?> <?php else: ?>
<?= $whose . ucfirst($url_type) . ' Collection' ?> <?= $helper->a(
$url->generate("{$url_type}.collection.view") . $extraSegment,
$whose . ucfirst($url_type) . ' Collection'
) ?>
<?php if($config->get("show_{$other_type}_collection")): ?> <?php if($config->get("show_{$other_type}_collection")): ?>
[<?= $helper->a( [<?= $helper->a(
$url->generate("{$other_type}.collection.view") . $extraSegment, $url->generate("{$other_type}.collection.view") . $extraSegment,

View File

@ -34,10 +34,10 @@
} }
}, },
"require": { "require": {
"amphp/http-client": "^4.2", "amphp/http-client": "^4.2.2",
"aura/html": "^2.0", "aura/html": "^2.5.0",
"aura/router": "^3.0", "aura/router": "^3.1.0",
"aura/session": "^2.0", "aura/session": "^2.1.0",
"aviat/banker": "^2.0.0", "aviat/banker": "^2.0.0",
"aviat/query": "^3.0.0", "aviat/query": "^3.0.0",
"danielstjules/stringy": "^3.1.0", "danielstjules/stringy": "^3.1.0",
@ -46,31 +46,31 @@
"ext-json": "*", "ext-json": "*",
"ext-gd": "*", "ext-gd": "*",
"ext-pdo": "*", "ext-pdo": "*",
"laminas/laminas-diactoros": "^2.0.0", "laminas/laminas-diactoros": "^2.2.3",
"laminas/laminas-httphandlerrunner": "^1.0", "laminas/laminas-httphandlerrunner": "^1.1.0",
"maximebf/consolekit": "^1.0", "maximebf/consolekit": "^1.0.3",
"monolog/monolog": "^2.0.1", "monolog/monolog": "^2.0.2",
"php": ">=7.4", "php": ">=7.4",
"psr/container": "~1.0", "psr/container": "^1.0.0",
"psr/http-message": "~1.0", "psr/http-message": "^1.0.1",
"psr/log": "~1.0", "psr/log": "^1.1.3",
"yosymfony/toml": "^1.0" "yosymfony/toml": "^1.0.4"
}, },
"require-dev": { "require-dev": {
"consolidation/robo": "^2.0.0", "consolidation/robo": "^2.0.0",
"filp/whoops": "^2.1", "filp/whoops": "^2.1",
"pdepend/pdepend": "^2.2", "pdepend/pdepend": "^2.",
"phploc/phploc": "^6.0.2", "phploc/phploc": "^5.0.0",
"phpmd/phpmd": "^2.8", "phpmd/phpmd": "^2.8.2",
"phpstan/phpstan": "^0.12.0", "phpstan/phpstan": "^0.12.19",
"phpunit/phpunit": "^9.1.1", "phpunit/phpunit": "^8.5.2",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",
"robmorgan/phinx": "^0.10.6", "robmorgan/phinx": "^0.10.6",
"sebastian/phpcpd": "^5.0.2", "sebastian/phpcpd": "^4.1.0",
"spatie/phpunit-snapshot-assertions": "^4.1.0", "spatie/phpunit-snapshot-assertions": "^4.1.0",
"squizlabs/php_codesniffer": "^3.2.2", "squizlabs/php_codesniffer": "^3.5.4",
"symfony/var-dumper": "^5", "symfony/var-dumper": "^5.0.7",
"theseer/phpdox": "*" "theseer/phpdox": "^0.12.0"
}, },
"scripts": { "scripts": {
"build": "vendor/bin/robo build", "build": "vendor/bin/robo build",

View File

@ -135,7 +135,6 @@ final class AnimeCollection extends Collection {
$id = $data['id']; $id = $data['id'];
$anime = (object)$this->animeModel->getAnimeById($id); $anime = (object)$this->animeModel->getAnimeById($id);
$this->db->beginTransaction();
$this->db->set([ $this->db->set([
'hummingbird_id' => $id, 'hummingbird_id' => $id,
'slug' => $anime->slug, 'slug' => $anime->slug,
@ -150,10 +149,7 @@ final class AnimeCollection extends Collection {
])->insert('anime_set'); ])->insert('anime_set');
$this->updateMediaLink($id, $data['media_id']); $this->updateMediaLink($id, $data['media_id']);
$this->updateGenres($id); $this->updateGenres($id);
$this->db->commit();
} }
/** /**
@ -197,8 +193,6 @@ final class AnimeCollection extends Collection {
$media = $data['media_id']; $media = $data['media_id'];
unset($data['hummingbird_id'], $data['media_id']); unset($data['hummingbird_id'], $data['media_id']);
$this->db->beginTransaction();
// If updating from the 'add' page, there // If updating from the 'add' page, there
// might be no data to actually update in // might be no data to actually update in
// the anime_set table // the anime_set table
@ -212,8 +206,6 @@ final class AnimeCollection extends Collection {
// Update media and genres // Update media and genres
$this->updateMediaLink($id, $media); $this->updateMediaLink($id, $media);
$this->updateGenres($id); $this->updateGenres($id);
$this->db->commit();
} }
/** /**
@ -236,12 +228,7 @@ final class AnimeCollection extends Collection {
{ {
if (is_array($row[$key])) if (is_array($row[$key]))
{ {
if ($row[$key] === $value) continue;
{
continue;
}
return FALSE;
} }
if ((string)$row[$key] !== (string)$value) if ((string)$row[$key] !== (string)$value)
@ -417,6 +404,8 @@ final class AnimeCollection extends Collection {
private function updateMediaLink(string $animeId, array $media): void private function updateMediaLink(string $animeId, array $media): void
{ {
$this->db->beginTransaction();
// Delete the old entries // Delete the old entries
$this->db->where('hummingbird_id', $animeId) $this->db->where('hummingbird_id', $animeId)
->delete('anime_set_media_link'); ->delete('anime_set_media_link');
@ -432,6 +421,8 @@ final class AnimeCollection extends Collection {
} }
$this->db->insertBatch('anime_set_media_link', $entries); $this->db->insertBatch('anime_set_media_link', $entries);
$this->db->commit();
} }
/** /**
@ -478,17 +469,7 @@ final class AnimeCollection extends Collection {
if ( ! empty($linksToInsert)) if ( ! empty($linksToInsert))
{ {
try $this->db->insertBatch('genre_anime_set_link', $linksToInsert);
{
$this->db->insertBatch('genre_anime_set_link', $linksToInsert);
}
catch (PDOException $e)
{
// This often results in a unique constraint violation
// So swallow this for now
// @TODO Fix properly
}
} }
} }

View File

@ -25,27 +25,27 @@ class Anime extends AbstractType {
/** /**
* @var string * @var string
*/ */
public ?string $age_rating = ''; public ?string $age_rating;
/** /**
* @var string * @var string
*/ */
public ?string $age_rating_guide = ''; public ?string $age_rating_guide;
/** /**
* @var string * @var string
*/ */
public string $cover_image = ''; public ?string $cover_image;
/** /**
* @var string|int * @var string|int
*/ */
public ?int $episode_count = 13; public ?int $episode_count;
/** /**
* @var string|int * @var string|int
*/ */
public ?int $episode_length = 24; public ?int $episode_length;
/** /**
* @var array * @var array
@ -65,12 +65,12 @@ class Anime extends AbstractType {
/** /**
* @var string * @var string
*/ */
public string $show_type = ''; public ?string $show_type;
/** /**
* @var string * @var string
*/ */
public string $slug = ''; public ?string $slug;
/** /**
* @var AnimeAiringStatus * @var AnimeAiringStatus
@ -85,12 +85,12 @@ class Anime extends AbstractType {
/** /**
* @var string * @var string
*/ */
public string $synopsis = ''; public ?string $synopsis;
/** /**
* @var string * @var string
*/ */
public string $title = ''; public ?string $title;
/** /**
* @var array * @var array
@ -100,10 +100,10 @@ class Anime extends AbstractType {
/** /**
* @var string * @var string
*/ */
public ?string $trailer_id = ''; public ?string $trailer_id;
/** /**
* @var string * @var string
*/ */
public string $url = ''; public ?string $url;
} }

View File

@ -23,12 +23,12 @@ final class AnimeListItem extends AbstractType {
/** /**
* @var string * @var string
*/ */
public $id; public ?string $id;
/** /**
* @var string * @var string
*/ */
public $mal_id; public ?string $mal_id;
/** /**
* @var string * @var string
@ -38,7 +38,7 @@ final class AnimeListItem extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $episodes = [ public array $episodes = [
'length' => 0, 'length' => 0,
'total' => 0, 'total' => 0,
'watched' => '', 'watched' => '',
@ -47,7 +47,7 @@ final class AnimeListItem extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $airing = [ public array $airing = [
'status' => '', 'status' => '',
'started' => '', 'started' => '',
'ended' => '', 'ended' => '',
@ -56,32 +56,32 @@ final class AnimeListItem extends AbstractType {
/** /**
* @var Anime * @var Anime
*/ */
public $anime; public ?Anime $anime;
/** /**
* @var string * @var string
*/ */
public $notes = ''; public ?string $notes;
/** /**
* @var bool * @var bool
*/ */
public $private; public bool $private = FALSE;
/** /**
* @var bool * @var bool
*/ */
public $rewatching; public bool $rewatching = FALSE;
/** /**
* @var int * @var int
*/ */
public $rewatched; public int $rewatched = 0;
/** /**
* @var int * @var string|int
*/ */
public $user_rating; public $user_rating = '';
/** /**
* One of Aviat\AnimeClient\API\Enum\AnimeWatchingStatus * One of Aviat\AnimeClient\API\Enum\AnimeWatchingStatus

View File

@ -23,12 +23,12 @@ final class Character extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $castings; public array $castings = [];
/** /**
* @var string * @var string
*/ */
public $description; public ?string $description;
/** /**
* @var string * @var string
@ -38,27 +38,27 @@ final class Character extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $included; public array $included = [];
/** /**
* @var Media * @var Media
*/ */
public $media; public ?Media $media;
/** /**
* @var string * @var string
*/ */
public $name; public ?string $name;
/** /**
* @var array * @var array
*/ */
public $names; public array $names = [];
/** /**
* @var array * @var array
*/ */
public $otherNames; public array $otherNames = [];
public function setMedia ($media): void public function setMedia ($media): void
{ {

View File

@ -20,10 +20,10 @@ final class Characters extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $main; public array $main = [];
/** /**
* @var array * @var array
*/ */
public $supporting; public array $supporting = [];
} }

View File

@ -25,17 +25,17 @@ class Config extends AbstractType {
/** /**
* @var Config\Anilist * @var Config\Anilist
*/ */
public $anilist; public ?Config\Anilist $anilist;
/** /**
* @var Config\Cache * @var Config\Cache
*/ */
public $cache; public ?Config\Cache $cache;
/** /**
* @var Config\Database * @var Config\Database
*/ */
public $database; public ?Config\Database $database;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Settings in config.toml // Settings in config.toml
@ -44,7 +44,7 @@ class Config extends AbstractType {
/** /**
* @var string * @var string
*/ */
public $asset_path; // Path to public folder for urls public ?string $asset_path; // Path to public folder for urls
/** /**
* @deprecated Use 'theme' instead * @deprecated Use 'theme' instead
@ -63,14 +63,14 @@ class Config extends AbstractType {
* *
* @var string * @var string
*/ */
public $default_anime_list_path; public ?string $default_anime_list_path;
/** /**
* The list to redirect to from the root url * The list to redirect to from the root url
* *
* @var 'anime' | 'manga' * @var 'anime' | 'manga'
*/ */
public $default_list; public ?string $default_list;
/** /**
* Default Manga list status page, values are listed in * Default Manga list status page, values are listed in
@ -78,44 +78,44 @@ class Config extends AbstractType {
* *
* @var string * @var string
*/ */
public $default_manga_list_path; public ?string $default_manga_list_path;
/** /**
* @var 'cover_view' | 'list_view' * @var 'cover_view' | 'list_view'
*/ */
public $default_view_type; public ?string $default_view_type;
/** /**
* @var string * @var string
*/ */
public $kitsu_username; public ?string $kitsu_username;
/** /**
* @var bool * @var bool
*/ */
public $secure_urls = TRUE; public bool $secure_urls = TRUE;
/** /**
* @var bool * @var bool
*/ */
public $show_anime_collection; public bool $show_anime_collection = FALSE;
/** /**
* @var bool * @var bool
*/ */
public $show_manga_collection = FALSE; public bool $show_manga_collection = FALSE;
/** /**
* CSS theme: light, dark, or auto-switching * CSS theme: light, dark, or auto-switching
* *
* @var 'auto' | 'light' | 'dark' * @var 'auto' | 'light' | 'dark'
*/ */
public $theme; public ?string $theme;
/** /**
* @var string * @var string
*/ */
public $whose_list; public ?string $whose_list;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Application config // Application config
@ -124,12 +124,12 @@ class Config extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $menus; public array $menus;
/** /**
* @var array * @var array
*/ */
public $routes; public array $routes;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Generated config values // Generated config values
@ -138,32 +138,32 @@ class Config extends AbstractType {
/** /**
* @var string * @var string
*/ */
public $asset_dir; // Path to public folder for local files public ?string $asset_dir; // Path to public folder for local files
/** /**
* @var string * @var string
*/ */
public $base_config_dir; public ?string $base_config_dir;
/** /**
* @var string * @var string
*/ */
public $config_dir; public ?string $config_dir;
/** /**
* @var string * @var string
*/ */
public $data_cache_path; public ?string $data_cache_path;
/** /**
* @var string * @var string
*/ */
public $img_cache_path; public ?string $img_cache_path;
/** /**
* @var string * @var string
*/ */
public $view_path; public ?string $view_path;
public function setAnilist ($data): void public function setAnilist ($data): void
{ {

View File

@ -28,17 +28,17 @@ class FormItem extends AbstractType {
/** /**
* @var string * @var string
*/ */
public $anilist_item_id; public ?string $anilist_item_id;
/** /**
* @var string * @var string
*/ */
public $mal_id; public ?string $mal_id;
/** /**
* @var FormItemData * @var FormItemData
*/ */
public $data; public ?FormItemData $data;
public function setData($value): void public function setData($value): void
{ {

View File

@ -23,12 +23,12 @@ class FormItemData extends AbstractType {
/** /**
* @var string * @var string
*/ */
public $notes; public ?string $notes;
/** /**
* @var bool * @var bool
*/ */
public $private; public bool $private = FALSE;
/** /**
* @var int * @var int
@ -46,14 +46,14 @@ class FormItemData extends AbstractType {
public $ratingTwenty; public $ratingTwenty;
/** /**
* @var int * @var string|int
*/ */
public $reconsumeCount; public $reconsumeCount;
/** /**
* @var bool * @var bool
*/ */
public $reconsuming; public bool $reconsuming = FALSE;
/** /**
* @var string * @var string
@ -65,5 +65,5 @@ class FormItemData extends AbstractType {
* *
* @var string * @var string
*/ */
public $updatedAt; public ?string $updatedAt;
} }

View File

@ -20,10 +20,10 @@ final class Media extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $anime = []; public array $anime = [];
/** /**
* @var array * @var array
*/ */
public $manga = []; public array $manga = [];
} }

View File

@ -28,17 +28,17 @@ final class Person extends AbstractType {
/** /**
* @var string * @var string
*/ */
public $name; public ?string $name;
/** /**
* @var Characters * @var Characters
*/ */
public $characters; public ?Characters $characters;
/** /**
* @var array * @var array
*/ */
public $staff; public array $staff = [];
public function setCharacters($characters): void public function setCharacters($characters): void
{ {

View File

@ -23,45 +23,45 @@ final class User extends AbstractType {
/** /**
* @var string * @var string
*/ */
public $about; public ?string $about;
/** /**
* @var string * @var string
*/ */
public $avatar; public ?string $avatar;
/** /**
* @var array * @var array
*/ */
public $favorites; public ?array $favorites;
/** /**
* @var string * @var string
*/ */
public $location; public ?string $location;
/** /**
* @var string * @var string
*/ */
public $name; public ?string $name;
/** /**
* @var string * @var string
*/ */
public $slug; public ?string $slug;
/** /**
* @var array * @var array
*/ */
public $stats; public ?array $stats;
/** /**
* @var array * @var array
*/ */
public $waifu; public ?array $waifu;
/** /**
* @var string * @var string
*/ */
public $website; public ?string $website;
} }