mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-08 09:16:43 +02:00
chore: update CI to v4.6.3 + all php and js dependencies
This commit is contained in:
parent
96b2df15b0
commit
346c00e7b5
206 changed files with 6239 additions and 5336 deletions
|
|
@ -20,9 +20,11 @@ class DashboardController extends BaseController
|
|||
public function index(): string
|
||||
{
|
||||
$podcastsData = [];
|
||||
$podcastsCount = (new PodcastModel())->builder()
|
||||
$podcastsCount = new PodcastModel()
|
||||
->builder()
|
||||
->countAll();
|
||||
$podcastsLastPublishedAt = (new PodcastModel())->builder()
|
||||
$podcastsLastPublishedAt = new PodcastModel()
|
||||
->builder()
|
||||
->selectMax('published_at', 'last_published_at')
|
||||
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
||||
->get()
|
||||
|
|
@ -33,9 +35,11 @@ class DashboardController extends BaseController
|
|||
);
|
||||
|
||||
$episodesData = [];
|
||||
$episodesCount = (new EpisodeModel())->builder()
|
||||
$episodesCount = new EpisodeModel()
|
||||
->builder()
|
||||
->countAll();
|
||||
$episodesLastPublishedAt = (new EpisodeModel())->builder()
|
||||
$episodesLastPublishedAt = new EpisodeModel()
|
||||
->builder()
|
||||
->selectMax('published_at', 'last_published_at')
|
||||
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
||||
->get()
|
||||
|
|
@ -45,7 +49,8 @@ class DashboardController extends BaseController
|
|||
$episodesLastPublishedAt,
|
||||
);
|
||||
|
||||
$totalUploaded = (new MediaModel())->builder()
|
||||
$totalUploaded = new MediaModel()
|
||||
->builder()
|
||||
->selectSum('file_size')
|
||||
->get()
|
||||
->getResultArray()[0];
|
||||
|
|
@ -66,7 +71,8 @@ class DashboardController extends BaseController
|
|||
|
||||
$onlyPodcastId = null;
|
||||
if ($podcastsData['number_of_podcasts'] === 1) {
|
||||
$onlyPodcastId = (new PodcastModel())->first()
|
||||
$onlyPodcastId = new PodcastModel()
|
||||
->first()
|
||||
->id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class EpisodeController extends BaseController
|
|||
}
|
||||
|
||||
if (count($params) === 1) {
|
||||
if (! ($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) instanceof Podcast) {
|
||||
if (! ($podcast = new PodcastModel()->getPodcastById((int) $params[0])) instanceof Podcast) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ class EpisodeController extends BaseController
|
|||
}
|
||||
|
||||
if (
|
||||
! ($episode = (new EpisodeModel())->getEpisodeById((int) $params[1])) instanceof Episode
|
||||
! ($episode = new EpisodeModel()->getEpisodeById((int) $params[1])) instanceof Episode
|
||||
) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
|
@ -127,11 +127,13 @@ class EpisodeController extends BaseController
|
|||
{
|
||||
helper(['form']);
|
||||
|
||||
$currentSeasonNumber = (new EpisodeModel())->getCurrentSeasonNumber($podcast->id);
|
||||
$currentSeasonNumber = new EpisodeModel()
|
||||
->getCurrentSeasonNumber($podcast->id);
|
||||
$data = [
|
||||
'podcast' => $podcast,
|
||||
'currentSeasonNumber' => $currentSeasonNumber,
|
||||
'nextEpisodeNumber' => (new EpisodeModel())->getNextEpisodeNumber($podcast->id, $currentSeasonNumber),
|
||||
'nextEpisodeNumber' => new EpisodeModel()
|
||||
->getNextEpisodeNumber($podcast->id, $currentSeasonNumber),
|
||||
];
|
||||
|
||||
$this->setHtmlHead(lang('Episode.create'));
|
||||
|
|
@ -165,7 +167,7 @@ class EpisodeController extends BaseController
|
|||
|
||||
$validData = $this->validator->getValidated();
|
||||
|
||||
if ((new EpisodeModel())
|
||||
if (new EpisodeModel()
|
||||
->where([
|
||||
'slug' => $validData['slug'],
|
||||
'podcast_id' => $podcast->id,
|
||||
|
|
@ -315,7 +317,8 @@ class EpisodeController extends BaseController
|
|||
($transcriptRemoteUrl = $this->request->getPost('transcript_remote_url')) &&
|
||||
(($transcriptFile = $episode->transcript_id) !== null)
|
||||
) {
|
||||
(new MediaModel())->deleteMedia($episode->transcript);
|
||||
new MediaModel()
|
||||
->deleteMedia($episode->transcript);
|
||||
}
|
||||
|
||||
$episode->transcript_remote_url = $transcriptRemoteUrl === '' ? null : $transcriptRemoteUrl;
|
||||
|
|
@ -333,7 +336,8 @@ class EpisodeController extends BaseController
|
|||
($chaptersRemoteUrl = $this->request->getPost('chapters_remote_url')) &&
|
||||
(($chaptersFile = $episode->chapters) instanceof Chapters)
|
||||
) {
|
||||
(new MediaModel())->deleteMedia($episode->chapters);
|
||||
new MediaModel()
|
||||
->deleteMedia($episode->chapters);
|
||||
}
|
||||
|
||||
$episode->chapters_remote_url = $chaptersRemoteUrl === '' ? null : $chaptersRemoteUrl;
|
||||
|
|
@ -502,7 +506,7 @@ class EpisodeController extends BaseController
|
|||
$data = [
|
||||
'podcast' => $episode->podcast,
|
||||
'episode' => $episode,
|
||||
'post' => (new PostModel())
|
||||
'post' => new PostModel()
|
||||
->where([
|
||||
'actor_id' => $episode->podcast->actor_id,
|
||||
'episode_id' => $episode->id,
|
||||
|
|
@ -571,7 +575,8 @@ class EpisodeController extends BaseController
|
|||
$episode->published_at = Time::now();
|
||||
}
|
||||
|
||||
$post = (new PostModel())->getPostById($this->request->getPost('post_id'));
|
||||
$post = new PostModel()
|
||||
->getPostById($this->request->getPost('post_id'));
|
||||
|
||||
if ($post instanceof Post) {
|
||||
$post->message = $this->request->getPost('message');
|
||||
|
|
@ -761,7 +766,7 @@ class EpisodeController extends BaseController
|
|||
|
||||
$db->transStart();
|
||||
|
||||
$allPostsLinkedToEpisode = (new PostModel())
|
||||
$allPostsLinkedToEpisode = new PostModel()
|
||||
->where([
|
||||
'episode_id' => $episode->id,
|
||||
'in_reply_to_id' => null,
|
||||
|
|
@ -769,17 +774,19 @@ class EpisodeController extends BaseController
|
|||
])
|
||||
->findAll();
|
||||
foreach ($allPostsLinkedToEpisode as $post) {
|
||||
(new PostModel())->removePost($post);
|
||||
new PostModel()
|
||||
->removePost($post);
|
||||
}
|
||||
|
||||
$allCommentsLinkedToEpisode = (new EpisodeCommentModel())
|
||||
$allCommentsLinkedToEpisode = new EpisodeCommentModel()
|
||||
->where([
|
||||
'episode_id' => $episode->id,
|
||||
'in_reply_to_id' => null,
|
||||
])
|
||||
->findAll();
|
||||
foreach ($allCommentsLinkedToEpisode as $comment) {
|
||||
(new EpisodeCommentModel())->removeComment($comment);
|
||||
new EpisodeCommentModel()
|
||||
->removeComment($comment);
|
||||
}
|
||||
|
||||
// set episode published_at to null to unpublish
|
||||
|
|
@ -795,9 +802,10 @@ class EpisodeController extends BaseController
|
|||
}
|
||||
|
||||
// set podcast is_published_on_hubs to false to trigger websub push
|
||||
(new PodcastModel())->update($episode->podcast_id, [
|
||||
'is_published_on_hubs' => 0,
|
||||
]);
|
||||
new PodcastModel()
|
||||
->update($episode->podcast_id, [
|
||||
'is_published_on_hubs' => 0,
|
||||
]);
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class EpisodePersonController extends BaseController
|
|||
}
|
||||
|
||||
if (count($params) === 1) {
|
||||
if (! ($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) instanceof Podcast) {
|
||||
if (! ($podcast = new PodcastModel()->getPodcastById((int) $params[0])) instanceof Podcast) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ class EpisodePersonController extends BaseController
|
|||
}
|
||||
|
||||
if (
|
||||
! ($episode = (new EpisodeModel())->getEpisodeById((int) $params[1])) instanceof Episode
|
||||
! ($episode = new EpisodeModel()->getEpisodeById((int) $params[1])) instanceof Episode
|
||||
) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
|
@ -51,10 +51,12 @@ class EpisodePersonController extends BaseController
|
|||
helper('form');
|
||||
|
||||
$data = [
|
||||
'episode' => $episode,
|
||||
'podcast' => $episode->podcast,
|
||||
'personOptions' => (new PersonModel())->getPersonOptions(),
|
||||
'taxonomyOptions' => (new PersonModel())->getTaxonomyOptions(),
|
||||
'episode' => $episode,
|
||||
'podcast' => $episode->podcast,
|
||||
'personOptions' => new PersonModel()
|
||||
->getPersonOptions(),
|
||||
'taxonomyOptions' => new PersonModel()
|
||||
->getTaxonomyOptions(),
|
||||
];
|
||||
|
||||
$this->setHtmlHead(lang('Person.episode_form.title'));
|
||||
|
|
@ -80,19 +82,21 @@ class EpisodePersonController extends BaseController
|
|||
|
||||
$validData = $this->validator->getValidated();
|
||||
|
||||
(new PersonModel())->addEpisodePersons(
|
||||
$episode->podcast_id,
|
||||
$episode->id,
|
||||
$validData['persons'],
|
||||
$this->request->getPost('roles') ?? [],
|
||||
);
|
||||
new PersonModel()
|
||||
->addEpisodePersons(
|
||||
$episode->podcast_id,
|
||||
$episode->id,
|
||||
$validData['persons'],
|
||||
$this->request->getPost('roles') ?? [],
|
||||
);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function deleteAction(Episode $episode, string $personId): RedirectResponse
|
||||
{
|
||||
(new PersonModel())->removePersonFromEpisode($episode->podcast_id, $episode->id, (int) $personId);
|
||||
new PersonModel()
|
||||
->removePersonFromEpisode($episode->podcast_id, $episode->id, (int) $personId);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class NotificationController extends BaseController
|
|||
}
|
||||
|
||||
if (
|
||||
! ($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) instanceof Podcast
|
||||
! ($podcast = new PodcastModel()->getPodcastById((int) $params[0])) instanceof Podcast
|
||||
) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ class NotificationController extends BaseController
|
|||
|
||||
if (count($params) > 1) {
|
||||
if (
|
||||
! ($notification = (new NotificationModel())->find($params[1])) instanceof Notification
|
||||
! ($notification = new NotificationModel()->find($params[1])) instanceof Notification
|
||||
) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
|
@ -54,7 +54,8 @@ class NotificationController extends BaseController
|
|||
|
||||
public function list(Podcast $podcast): string
|
||||
{
|
||||
$notifications = (new NotificationModel())->where('target_actor_id', $podcast->actor_id)
|
||||
$notifications = new NotificationModel()
|
||||
->where('target_actor_id', $podcast->actor_id)
|
||||
->orderBy('created_at', 'desc');
|
||||
|
||||
$data = [
|
||||
|
|
@ -72,13 +73,15 @@ class NotificationController extends BaseController
|
|||
|
||||
public function markAllAsReadAction(Podcast $podcast): RedirectResponse
|
||||
{
|
||||
$notifications = (new NotificationModel())->where('target_actor_id', $podcast->actor_id)
|
||||
$notifications = new NotificationModel()
|
||||
->where('target_actor_id', $podcast->actor_id)
|
||||
->where('read_at', null)
|
||||
->findAll();
|
||||
|
||||
foreach ($notifications as $notification) {
|
||||
$notification->read_at = new Time('now');
|
||||
(new NotificationModel())->update($notification->id, $notification);
|
||||
new NotificationModel()
|
||||
->update($notification->id, $notification);
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
|
|
@ -94,7 +97,8 @@ class NotificationController extends BaseController
|
|||
return redirect()->route('podcast-activity', [esc($podcast->handle)]);
|
||||
}
|
||||
|
||||
$post = (new PostModel())->getPostById($notification->post_id);
|
||||
$post = new PostModel()
|
||||
->getPostById($notification->post_id);
|
||||
|
||||
return redirect()->route('post', [$podcast->handle, $post->id]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class PageController extends BaseController
|
|||
return $this->{$method}();
|
||||
}
|
||||
|
||||
if (($page = (new PageModel())->find($params[0])) instanceof Page) {
|
||||
if (($page = new PageModel()->find($params[0])) instanceof Page) {
|
||||
return $this->{$method}($page);
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +34,8 @@ class PageController extends BaseController
|
|||
{
|
||||
$this->setHtmlHead(lang('Page.all_pages'));
|
||||
$data = [
|
||||
'pages' => (new PageModel())->findAll(),
|
||||
'pages' => new PageModel()
|
||||
->findAll(),
|
||||
];
|
||||
|
||||
return view('page/list', $data);
|
||||
|
|
@ -113,7 +114,8 @@ class PageController extends BaseController
|
|||
|
||||
public function deleteAction(Page $page): RedirectResponse
|
||||
{
|
||||
(new PageModel())->delete($page->id);
|
||||
new PageModel()
|
||||
->delete($page->id);
|
||||
|
||||
return redirect()->route('page-list');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class PersonController extends BaseController
|
|||
}
|
||||
|
||||
if (
|
||||
($person = (new PersonModel())->getPersonById((int) $params[0])) instanceof Person
|
||||
($person = new PersonModel()->getPersonById((int) $params[0])) instanceof Person
|
||||
) {
|
||||
return $this->{$method}($person);
|
||||
}
|
||||
|
|
@ -36,7 +36,8 @@ class PersonController extends BaseController
|
|||
public function list(): string
|
||||
{
|
||||
$data = [
|
||||
'persons' => (new PersonModel())->orderBy('full_name')
|
||||
'persons' => new PersonModel()
|
||||
->orderBy('full_name')
|
||||
->findAll(),
|
||||
];
|
||||
|
||||
|
|
@ -157,10 +158,12 @@ class PersonController extends BaseController
|
|||
{
|
||||
if ($person->avatar_id !== null) {
|
||||
// delete avatar to prevent collision if recreating person
|
||||
(new MediaModel())->deleteMedia($person->avatar);
|
||||
new MediaModel()
|
||||
->deleteMedia($person->avatar);
|
||||
}
|
||||
|
||||
(new PersonModel())->delete($person->id);
|
||||
new PersonModel()
|
||||
->delete($person->id);
|
||||
|
||||
return redirect()->route('person-list')
|
||||
->with('message', lang('Person.messages.deleteSuccess'));
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class PodcastController extends BaseController
|
|||
}
|
||||
|
||||
if (
|
||||
($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) instanceof Podcast
|
||||
($podcast = new PodcastModel()->getPodcastById((int) $params[0])) instanceof Podcast
|
||||
) {
|
||||
return $this->{$method}($podcast);
|
||||
}
|
||||
|
|
@ -57,7 +57,8 @@ class PodcastController extends BaseController
|
|||
{
|
||||
if (auth()->user()->can('podcasts.view')) {
|
||||
$data = [
|
||||
'podcasts' => (new PodcastModel())->findAll(),
|
||||
'podcasts' => new PodcastModel()
|
||||
->findAll(),
|
||||
];
|
||||
} else {
|
||||
$data = [
|
||||
|
|
@ -177,8 +178,10 @@ class PodcastController extends BaseController
|
|||
{
|
||||
helper(['form', 'misc']);
|
||||
|
||||
$languageOptions = (new LanguageModel())->getLanguageOptions();
|
||||
$categoryOptions = (new CategoryModel())->getCategoryOptions();
|
||||
$languageOptions = new LanguageModel()
|
||||
->getLanguageOptions();
|
||||
$categoryOptions = new CategoryModel()
|
||||
->getCategoryOptions();
|
||||
|
||||
$data = [
|
||||
'languageOptions' => $languageOptions,
|
||||
|
|
@ -251,10 +254,8 @@ class PodcastController extends BaseController
|
|||
add_podcast_group(auth()->user(), (int) $newPodcastId, setting('AuthGroups.mostPowerfulPodcastGroup'));
|
||||
|
||||
// set Podcast categories
|
||||
(new CategoryModel())->setPodcastCategories(
|
||||
(int) $newPodcastId,
|
||||
$this->request->getPost('other_categories') ?? [],
|
||||
);
|
||||
new CategoryModel()
|
||||
->setPodcastCategories((int) $newPodcastId, $this->request->getPost('other_categories') ?? []);
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
|
|
@ -268,8 +269,10 @@ class PodcastController extends BaseController
|
|||
{
|
||||
helper('form');
|
||||
|
||||
$languageOptions = (new LanguageModel())->getLanguageOptions();
|
||||
$categoryOptions = (new CategoryModel())->getCategoryOptions();
|
||||
$languageOptions = new LanguageModel()
|
||||
->getLanguageOptions();
|
||||
$categoryOptions = new CategoryModel()
|
||||
->getCategoryOptions();
|
||||
|
||||
$data = [
|
||||
'podcast' => $podcast,
|
||||
|
|
@ -346,10 +349,8 @@ class PodcastController extends BaseController
|
|||
}
|
||||
|
||||
// set Podcast categories
|
||||
(new CategoryModel())->setPodcastCategories(
|
||||
$podcast->id,
|
||||
$this->request->getPost('other_categories') ?? [],
|
||||
);
|
||||
new CategoryModel()
|
||||
->setPodcastCategories($podcast->id, $this->request->getPost('other_categories') ?? []);
|
||||
|
||||
// New feed url redirect
|
||||
service('settings')
|
||||
|
|
@ -385,18 +386,21 @@ class PodcastController extends BaseController
|
|||
->with('errors', $mediaModel->errors());
|
||||
}
|
||||
|
||||
(new PodcastModel())->clearCache([
|
||||
'id' => $podcast->id,
|
||||
]);
|
||||
new PodcastModel()
|
||||
->clearCache([
|
||||
'id' => $podcast->id,
|
||||
]);
|
||||
|
||||
// remove banner url from actor
|
||||
$actor = (new ActorModel())->getActorById($podcast->actor_id);
|
||||
$actor = new ActorModel()
|
||||
->getActorById($podcast->actor_id);
|
||||
|
||||
if ($actor instanceof Actor) {
|
||||
$actor->cover_image_url = null;
|
||||
$actor->cover_image_mimetype = null;
|
||||
|
||||
(new ActorModel())->update($actor->id, $actor);
|
||||
new ActorModel()
|
||||
->update($actor->id, $actor);
|
||||
}
|
||||
|
||||
$db->transComplete();
|
||||
|
|
@ -406,7 +410,7 @@ class PodcastController extends BaseController
|
|||
|
||||
public function latestEpisodesView(int $limit, int $podcastId): string
|
||||
{
|
||||
$episodes = (new EpisodeModel())
|
||||
$episodes = new EpisodeModel()
|
||||
->where('podcast_id', $podcastId)
|
||||
->orderBy('-`published_at`', '', false)
|
||||
->orderBy('created_at', 'desc')
|
||||
|
|
@ -414,7 +418,8 @@ class PodcastController extends BaseController
|
|||
|
||||
return view('podcast/latest_episodes', [
|
||||
'episodes' => $episodes,
|
||||
'podcast' => (new PodcastModel())->getPodcastById($podcastId),
|
||||
'podcast' => new PodcastModel()
|
||||
->getPodcastById($podcastId),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +456,8 @@ class PodcastController extends BaseController
|
|||
$db->transStart();
|
||||
|
||||
//delete podcast episodes
|
||||
$podcastEpisodes = (new EpisodeModel())->where('podcast_id', $podcast->id)
|
||||
$podcastEpisodes = new EpisodeModel()
|
||||
->where('podcast_id', $podcast->id)
|
||||
->findAll();
|
||||
|
||||
foreach ($podcastEpisodes as $podcastEpisode) {
|
||||
|
|
@ -669,7 +675,7 @@ class PodcastController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
$episodes = (new EpisodeModel())
|
||||
$episodes = new EpisodeModel()
|
||||
->where('podcast_id', $podcast->id)
|
||||
->where('published_at !=', null)
|
||||
->findAll();
|
||||
|
|
@ -686,7 +692,8 @@ class PodcastController extends BaseController
|
|||
->with('errors', $episodeModel->errors());
|
||||
}
|
||||
|
||||
$post = (new PostModel())->where('episode_id', $episode->id)
|
||||
$post = new PostModel()
|
||||
->where('episode_id', $episode->id)
|
||||
->first();
|
||||
|
||||
if ($post instanceof Post) {
|
||||
|
|
@ -722,7 +729,7 @@ class PodcastController extends BaseController
|
|||
|
||||
$data = [
|
||||
'podcast' => $podcast,
|
||||
'post' => (new PostModel())
|
||||
'post' => new PostModel()
|
||||
->where([
|
||||
'actor_id' => $podcast->actor_id,
|
||||
'episode_id' => null,
|
||||
|
|
@ -783,7 +790,7 @@ class PodcastController extends BaseController
|
|||
$podcast->published_at = Time::now();
|
||||
}
|
||||
|
||||
$post = (new PostModel())
|
||||
$post = new PostModel()
|
||||
->where([
|
||||
'actor_id' => $podcast->actor_id,
|
||||
'episode_id' => null,
|
||||
|
|
@ -837,7 +844,7 @@ class PodcastController extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
$episodes = (new EpisodeModel())
|
||||
$episodes = new EpisodeModel()
|
||||
->where('podcast_id', $podcast->id)
|
||||
->where('published_at !=', null)
|
||||
->findAll();
|
||||
|
|
@ -854,7 +861,8 @@ class PodcastController extends BaseController
|
|||
->with('errors', $episodeModel->errors());
|
||||
}
|
||||
|
||||
$post = (new PostModel())->where('episode_id', $episode->id)
|
||||
$post = new PostModel()
|
||||
->where('episode_id', $episode->id)
|
||||
->first();
|
||||
|
||||
if ($post instanceof Post) {
|
||||
|
|
@ -904,7 +912,7 @@ class PodcastController extends BaseController
|
|||
$postModel->removePost($post);
|
||||
}
|
||||
|
||||
$episodes = (new EpisodeModel())
|
||||
$episodes = new EpisodeModel()
|
||||
->where('podcast_id', $podcast->id)
|
||||
->where('published_at !=', null)
|
||||
->findAll();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class PodcastPersonController extends BaseController
|
|||
}
|
||||
|
||||
if (
|
||||
($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) instanceof Podcast
|
||||
($podcast = new PodcastModel()->getPodcastById((int) $params[0])) instanceof Podcast
|
||||
) {
|
||||
unset($params[0]);
|
||||
return $this->{$method}($podcast, ...$params);
|
||||
|
|
@ -41,10 +41,13 @@ class PodcastPersonController extends BaseController
|
|||
helper('form');
|
||||
|
||||
$data = [
|
||||
'podcast' => $podcast,
|
||||
'podcastPersons' => (new PersonModel())->getPodcastPersons($podcast->id),
|
||||
'personOptions' => (new PersonModel())->getPersonOptions(),
|
||||
'taxonomyOptions' => (new PersonModel())->getTaxonomyOptions(),
|
||||
'podcast' => $podcast,
|
||||
'podcastPersons' => new PersonModel()
|
||||
->getPodcastPersons($podcast->id),
|
||||
'personOptions' => new PersonModel()
|
||||
->getPersonOptions(),
|
||||
'taxonomyOptions' => new PersonModel()
|
||||
->getTaxonomyOptions(),
|
||||
];
|
||||
|
||||
$this->setHtmlHead(lang('Person.podcast_form.title'));
|
||||
|
|
@ -69,18 +72,16 @@ class PodcastPersonController extends BaseController
|
|||
|
||||
$validData = $this->validator->getValidated();
|
||||
|
||||
(new PersonModel())->addPodcastPersons(
|
||||
$podcast->id,
|
||||
$validData['persons'],
|
||||
$this->request->getPost('roles') ?? [],
|
||||
);
|
||||
new PersonModel()
|
||||
->addPodcastPersons($podcast->id, $validData['persons'], $this->request->getPost('roles') ?? []);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function deleteAction(Podcast $podcast, string $personId): RedirectResponse
|
||||
{
|
||||
(new PersonModel())->removePersonFromPodcast($podcast->id, (int) $personId);
|
||||
new PersonModel()
|
||||
->removePersonFromPodcast($podcast->id, (int) $personId);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ class SettingsController extends BaseController
|
|||
public function regenerateImagesAction(): RedirectResponse
|
||||
{
|
||||
/** @var Podcast[] $allPodcasts */
|
||||
$allPodcasts = (new PodcastModel())->findAll();
|
||||
$allPodcasts = new PodcastModel()
|
||||
->findAll();
|
||||
|
||||
/** @var FileManagerInterface $fileManager */
|
||||
$fileManager = service('file_manager');
|
||||
|
|
@ -158,7 +159,8 @@ class SettingsController extends BaseController
|
|||
|
||||
$fileManager->deletePersonImagesSizes();
|
||||
|
||||
$persons = (new PersonModel())->findAll();
|
||||
$persons = new PersonModel()
|
||||
->findAll();
|
||||
foreach ($persons as $person) {
|
||||
if ($person->avatar_id !== null) {
|
||||
$person->avatar->saveSizes();
|
||||
|
|
@ -172,16 +174,26 @@ class SettingsController extends BaseController
|
|||
{
|
||||
if ($this->request->getPost('reset_counts') === 'yes') {
|
||||
// recalculate fediverse counts
|
||||
(new ActorModel())->resetFollowersCount();
|
||||
(new ActorModel())->resetPostsCount();
|
||||
(new PostModel())->setEpisodeIdForRepliesOfEpisodePosts();
|
||||
(new PostModel())->resetFavouritesCount();
|
||||
(new PostModel())->resetReblogsCount();
|
||||
(new PostModel())->resetRepliesCount();
|
||||
(new EpisodeModel())->resetCommentsCount();
|
||||
(new EpisodeModel())->resetPostsCount();
|
||||
(new EpisodeCommentModel())->resetLikesCount();
|
||||
(new EpisodeCommentModel())->resetRepliesCount();
|
||||
new ActorModel()
|
||||
->resetFollowersCount();
|
||||
new ActorModel()
|
||||
->resetPostsCount();
|
||||
new PostModel()
|
||||
->setEpisodeIdForRepliesOfEpisodePosts();
|
||||
new PostModel()
|
||||
->resetFavouritesCount();
|
||||
new PostModel()
|
||||
->resetReblogsCount();
|
||||
new PostModel()
|
||||
->resetRepliesCount();
|
||||
new EpisodeModel()
|
||||
->resetCommentsCount();
|
||||
new EpisodeModel()
|
||||
->resetPostsCount();
|
||||
new EpisodeCommentModel()
|
||||
->resetLikesCount();
|
||||
new EpisodeCommentModel()
|
||||
->resetRepliesCount();
|
||||
}
|
||||
|
||||
if ($this->request->getPost('clear_cache') === 'yes') {
|
||||
|
|
@ -190,7 +202,8 @@ class SettingsController extends BaseController
|
|||
|
||||
if ($this->request->getPost('rename_episodes_files') === 'yes') {
|
||||
/** @var Audio[] $allAudio */
|
||||
$allAudio = (new MediaModel('audio'))->getAllOfType();
|
||||
$allAudio = new MediaModel('audio')
|
||||
->getAllOfType();
|
||||
|
||||
foreach ($allAudio as $audio) {
|
||||
$audio->rename();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class SoundbiteController extends BaseController
|
|||
}
|
||||
|
||||
if (count($params) === 1) {
|
||||
if (! ($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) instanceof Podcast) {
|
||||
if (! ($podcast = new PodcastModel()->getPodcastById((int) $params[0])) instanceof Podcast) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class SoundbiteController extends BaseController
|
|||
}
|
||||
|
||||
if (
|
||||
! ($episode = (new EpisodeModel())->getEpisodeById((int) $params[1])) instanceof Episode
|
||||
! ($episode = new EpisodeModel()->getEpisodeById((int) $params[1])) instanceof Episode
|
||||
) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ class SoundbiteController extends BaseController
|
|||
|
||||
public function list(Episode $episode): string
|
||||
{
|
||||
$soundbitesBuilder = (new ClipModel('audio'))
|
||||
$soundbitesBuilder = new ClipModel('audio')
|
||||
->where([
|
||||
'podcast_id' => $episode->podcast_id,
|
||||
'episode_id' => $episode->id,
|
||||
|
|
@ -137,7 +137,8 @@ class SoundbiteController extends BaseController
|
|||
|
||||
public function deleteAction(Episode $episode, string $soundbiteId): RedirectResponse
|
||||
{
|
||||
$soundbite = (new ClipModel())->getSoundbiteById((int) $soundbiteId);
|
||||
$soundbite = new ClipModel()
|
||||
->getSoundbiteById((int) $soundbiteId);
|
||||
|
||||
if (! $soundbite instanceof Soundbite) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
|
|
@ -145,9 +146,11 @@ class SoundbiteController extends BaseController
|
|||
|
||||
if ($soundbite->media === null) {
|
||||
// delete Clip directly
|
||||
(new ClipModel())->deleteSoundbite($episode->podcast_id, $episode->id, $soundbite->id);
|
||||
new ClipModel()
|
||||
->deleteSoundbite($episode->podcast_id, $episode->id, $soundbite->id);
|
||||
} else {
|
||||
(new ClipModel())->clearSoundbiteCache($episode->podcast_id, $episode->id, $soundbite->id);
|
||||
new ClipModel()
|
||||
->clearSoundbiteCache($episode->podcast_id, $episode->id, $soundbite->id);
|
||||
|
||||
$mediaModel = new MediaModel();
|
||||
// delete the soundbite file, the clip will be deleted on cascade
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class VideoClipsController extends BaseController
|
|||
}
|
||||
|
||||
if (count($params) === 1) {
|
||||
if (! ($podcast = (new PodcastModel())->getPodcastById((int) $params[0])) instanceof Podcast) {
|
||||
if (! ($podcast = new PodcastModel()->getPodcastById((int) $params[0])) instanceof Podcast) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ class VideoClipsController extends BaseController
|
|||
}
|
||||
|
||||
if (
|
||||
! ($episode = (new EpisodeModel())->getEpisodeById((int) $params[1])) instanceof Episode
|
||||
! ($episode = new EpisodeModel()->getEpisodeById((int) $params[1])) instanceof Episode
|
||||
) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ class VideoClipsController extends BaseController
|
|||
|
||||
public function list(Episode $episode): string
|
||||
{
|
||||
$videoClipsBuilder = (new ClipModel('video'))
|
||||
$videoClipsBuilder = new ClipModel('video')
|
||||
->where([
|
||||
'podcast_id' => $episode->podcast_id,
|
||||
'episode_id' => $episode->id,
|
||||
|
|
@ -83,7 +83,8 @@ class VideoClipsController extends BaseController
|
|||
|
||||
public function view(Episode $episode, string $videoClipId): string
|
||||
{
|
||||
$videoClip = (new ClipModel())->getVideoClipById((int) $videoClipId);
|
||||
$videoClip = new ClipModel()
|
||||
->getVideoClipById((int) $videoClipId);
|
||||
|
||||
$data = [
|
||||
'podcast' => $episode->podcast,
|
||||
|
|
@ -176,7 +177,7 @@ class VideoClipsController extends BaseController
|
|||
]);
|
||||
|
||||
// Check if video clip exists before inserting a new line
|
||||
if ((new ClipModel())->doesVideoClipExist($videoClip)) {
|
||||
if (new ClipModel()->doesVideoClipExist($videoClip)) {
|
||||
// video clip already exists
|
||||
return redirect()
|
||||
->back()
|
||||
|
|
@ -184,7 +185,8 @@ class VideoClipsController extends BaseController
|
|||
->with('error', lang('VideoClip.messages.alreadyExistingError'));
|
||||
}
|
||||
|
||||
(new ClipModel())->insert($videoClip);
|
||||
new ClipModel()
|
||||
->insert($videoClip);
|
||||
|
||||
return redirect()->route('video-clips-list', [$episode->podcast_id, $episode->id])->with(
|
||||
'message',
|
||||
|
|
@ -194,24 +196,27 @@ class VideoClipsController extends BaseController
|
|||
|
||||
public function retryAction(Episode $episode, string $videoClipId): RedirectResponse
|
||||
{
|
||||
$videoClip = (new ClipModel())->getVideoClipById((int) $videoClipId);
|
||||
$videoClip = new ClipModel()
|
||||
->getVideoClipById((int) $videoClipId);
|
||||
|
||||
if (! $videoClip instanceof VideoClip) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
(new ClipModel())->update($videoClip->id, [
|
||||
'status' => 'queued',
|
||||
'job_started_at' => null,
|
||||
'job_ended_at' => null,
|
||||
]);
|
||||
new ClipModel()
|
||||
->update($videoClip->id, [
|
||||
'status' => 'queued',
|
||||
'job_started_at' => null,
|
||||
'job_ended_at' => null,
|
||||
]);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
public function deleteAction(Episode $episode, string $videoClipId): RedirectResponse
|
||||
{
|
||||
$videoClip = (new ClipModel())->getVideoClipById((int) $videoClipId);
|
||||
$videoClip = new ClipModel()
|
||||
->getVideoClipById((int) $videoClipId);
|
||||
|
||||
if (! $videoClip instanceof VideoClip) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
|
|
@ -219,9 +224,11 @@ class VideoClipsController extends BaseController
|
|||
|
||||
if ($videoClip->media === null) {
|
||||
// delete Clip directly
|
||||
(new ClipModel())->deleteVideoClip($episode->podcast_id, $episode->id, $videoClip->id);
|
||||
new ClipModel()
|
||||
->deleteVideoClip($videoClip->id);
|
||||
} else {
|
||||
(new ClipModel())->clearVideoClipCache($videoClip->id);
|
||||
new ClipModel()
|
||||
->clearVideoClipCache($videoClip->id);
|
||||
|
||||
$mediaModel = new MediaModel();
|
||||
// delete the videoClip file, the clip will be deleted on cascade
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue