feat(import): run podcast imports' processes asynchronously using tasks

- use codeigniter4/tasks project to handle cron tasks
- use yassinedoghri/podcast-feed project to parse feeds for imports
This commit is contained in:
Yassine Doghri 2023-06-21 16:17:11 +00:00
commit d8e1d4031d
106 changed files with 1805 additions and 1097 deletions

View file

@ -283,7 +283,7 @@ class EpisodeModel extends Model
public function getCurrentSeasonNumber(int $podcastId): ?int
{
$result = $this->builder()
->select('MAX(season_number) as current_season_number')
->selectMax('season_number', 'current_season_number')
->where([
'podcast_id' => $podcastId,
'published_at IS NOT' => null,
@ -297,7 +297,7 @@ class EpisodeModel extends Model
public function getNextEpisodeNumber(int $podcastId, ?int $seasonNumber): int
{
$result = $this->builder()
->select('MAX(number) as next_episode_number')
->selectMax('number', 'next_episode_number')
->where([
'podcast_id' => $podcastId,
'season_number' => $seasonNumber,
@ -466,6 +466,19 @@ class EpisodeModel extends Model
return $this->builder;
}
public function getFullTextMatchClauseForEpisodes(string $table, string $value): string
{
return '
MATCH (
' . $table . '.title,
' . $table . '.description_markdown,
' . $table . '.slug,
' . $table . '.location_name
)
AGAINST(' . $this->db->escape($value) . ')
';
}
/**
* @param mixed[] $data
*
@ -494,17 +507,4 @@ class EpisodeModel extends Model
return $data;
}
private function getFullTextMatchClauseForEpisodes(string $table, string $value): string
{
return '
MATCH (
' . $table . '.title,
' . $table . '.description_markdown,
' . $table . '.slug,
' . $table . '.location_name
)
AGAINST("*' . preg_replace('/[^\p{L}\p{N}_]+/u', ' ', $value) . '*" IN BOOLEAN MODE)
';
}
}