Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
19 changed files with 106 additions and 122 deletions
Showing only changes of commit 95a7e74d69 - Show all commits

View File

@ -33,7 +33,10 @@ $hasManga = stripos($_SERVER['REQUEST_URI'], 'manga') !== FALSE;
ucfirst($other_type) . ' List'
) ?>]
<?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")): ?>
[<?= $helper->a(
$url->generate("{$other_type}.collection.view") . $extraSegment,

View File

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

View File

@ -135,7 +135,6 @@ final class AnimeCollection extends Collection {
$id = $data['id'];
$anime = (object)$this->animeModel->getAnimeById($id);
$this->db->beginTransaction();
$this->db->set([
'hummingbird_id' => $id,
'slug' => $anime->slug,
@ -150,10 +149,7 @@ final class AnimeCollection extends Collection {
])->insert('anime_set');
$this->updateMediaLink($id, $data['media_id']);
$this->updateGenres($id);
$this->db->commit();
}
/**
@ -197,8 +193,6 @@ final class AnimeCollection extends Collection {
$media = $data['media_id'];
unset($data['hummingbird_id'], $data['media_id']);
$this->db->beginTransaction();
// If updating from the 'add' page, there
// might be no data to actually update in
// the anime_set table
@ -212,8 +206,6 @@ final class AnimeCollection extends Collection {
// Update media and genres
$this->updateMediaLink($id, $media);
$this->updateGenres($id);
$this->db->commit();
}
/**
@ -235,15 +227,10 @@ final class AnimeCollection extends Collection {
foreach ($data as $key => $value)
{
if (is_array($row[$key]))
{
if ($row[$key] === $value)
{
continue;
}
return FALSE;
}
if ((string)$row[$key] !== (string)$value)
{
return FALSE;
@ -417,6 +404,8 @@ final class AnimeCollection extends Collection {
private function updateMediaLink(string $animeId, array $media): void
{
$this->db->beginTransaction();
// Delete the old entries
$this->db->where('hummingbird_id', $animeId)
->delete('anime_set_media_link');
@ -432,6 +421,8 @@ final class AnimeCollection extends Collection {
}
$this->db->insertBatch('anime_set_media_link', $entries);
$this->db->commit();
}
/**
@ -477,19 +468,9 @@ final class AnimeCollection extends Collection {
}
if ( ! empty($linksToInsert))
{
try
{
$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
*/
public ?string $age_rating = '';
public ?string $age_rating;
/**
* @var string
*/
public ?string $age_rating_guide = '';
public ?string $age_rating_guide;
/**
* @var string
*/
public string $cover_image = '';
public ?string $cover_image;
/**
* @var string|int
*/
public ?int $episode_count = 13;
public ?int $episode_count;
/**
* @var string|int
*/
public ?int $episode_length = 24;
public ?int $episode_length;
/**
* @var array
@ -65,12 +65,12 @@ class Anime extends AbstractType {
/**
* @var string
*/
public string $show_type = '';
public ?string $show_type;
/**
* @var string
*/
public string $slug = '';
public ?string $slug;
/**
* @var AnimeAiringStatus
@ -85,12 +85,12 @@ class Anime extends AbstractType {
/**
* @var string
*/
public string $synopsis = '';
public ?string $synopsis;
/**
* @var string
*/
public string $title = '';
public ?string $title;
/**
* @var array
@ -100,10 +100,10 @@ class Anime extends AbstractType {
/**
* @var string
*/
public ?string $trailer_id = '';
public ?string $trailer_id;
/**
* @var string
*/
public string $url = '';
public ?string $url;
}

View File

@ -23,12 +23,12 @@ final class AnimeListItem extends AbstractType {
/**
* @var string
*/
public $id;
public ?string $id;
/**
* @var string
*/
public $mal_id;
public ?string $mal_id;
/**
* @var string
@ -38,7 +38,7 @@ final class AnimeListItem extends AbstractType {
/**
* @var array
*/
public $episodes = [
public array $episodes = [
'length' => 0,
'total' => 0,
'watched' => '',
@ -47,7 +47,7 @@ final class AnimeListItem extends AbstractType {
/**
* @var array
*/
public $airing = [
public array $airing = [
'status' => '',
'started' => '',
'ended' => '',
@ -56,32 +56,32 @@ final class AnimeListItem extends AbstractType {
/**
* @var Anime
*/
public $anime;
public ?Anime $anime;
/**
* @var string
*/
public $notes = '';
public ?string $notes;
/**
* @var bool
*/
public $private;
public bool $private = FALSE;
/**
* @var bool
*/
public $rewatching;
public bool $rewatching = FALSE;
/**
* @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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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