Loading app/Controllers/Podcast.php +7 −5 Original line number Diff line number Diff line Loading @@ -69,19 +69,21 @@ class Podcast extends BaseController $defaultQuery = (new EpisodeModel())->getDefaultQuery( $this->podcast->id, ); if ($defaultQuery) { if ($defaultQuery['type'] == 'season') { $seasonQuery = $defaultQuery['data']['season_number']; } elseif ($defaultQuery['type'] == 'year') { $yearQuery = $defaultQuery['data']['year']; } } } $cacheName = implode( '_', array_filter([ 'page', "podcast{$this->podcast->id}", $yearQuery, $yearQuery ? 'year' . $yearQuery : null, $seasonQuery ? 'season' . $seasonQuery : null, service('request')->getLocale(), ]), Loading app/Models/EpisodeModel.php +3 −3 Original line number Diff line number Diff line Loading @@ -314,7 +314,7 @@ class EpisodeModel extends Model * * @param int $podcastId * * @return array * @return array|null */ public function getDefaultQuery(int $podcastId) { Loading Loading @@ -419,11 +419,11 @@ class EpisodeModel extends Model foreach ($years as $year) { cache()->delete( "podcast{$episode->podcast_id}_{$year['year']}_episodes", "podcast{$episode->podcast_id}_year{$year['year']}_episodes", ); foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$episode->podcast_id}_{$year['year']}_{$locale}", "page_podcast{$episode->podcast_id}_year{$year['year']}_{$locale}", ); } } Loading app/Models/PageModel.php +4 −4 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ class PageModel extends Model protected function clearCache(array $data) { $page = (new PageModel())->find( is_array($data['id']) ? $data['id'][0] : $data['id'] is_array($data['id']) ? $data['id'][0] : $data['id'], ); // delete page cache Loading @@ -57,14 +57,14 @@ class PageModel extends Model foreach ($years as $year) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_{$year['year']}_{$locale}" "page_podcast{$podcast->id}_year{$year['year']}_{$locale}", ); } } foreach ($seasons as $season) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_season{$season['season_number']}_{$locale}" "page_podcast{$podcast->id}_season{$season['season_number']}_{$locale}", ); } } Loading @@ -72,7 +72,7 @@ class PageModel extends Model foreach ($podcast->episodes as $episode) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_episode{$episode->id}_{$locale}" "page_podcast{$podcast->id}_episode{$episode->id}_{$locale}", ); } } Loading app/Models/PlatformModel.php +18 −18 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class PlatformModel extends Model if (!($found = cache('platforms'))) { $baseUrl = rtrim(config('app')->baseURL, '/'); $found = $this->select( "*, CONCAT('{$baseUrl}/assets/images/platforms/',`type`,'/',`slug`,'.svg') as icon" "*, CONCAT('{$baseUrl}/assets/images/platforms/',`type`,'/',`slug`,'.svg') as icon", )->findAll(); cache()->save('platforms', $found, DECADE); } Loading Loading @@ -75,12 +75,12 @@ class PlatformModel extends Model !($found = cache("podcast{$podcastId}_platforms_{$platformType}")) ) { $found = $this->select( 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player' 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player', ) ->join( 'podcasts_platforms', "podcasts_platforms.platform_slug = platforms.slug AND podcasts_platforms.podcast_id = $podcastId", 'left' 'left', ) ->where('platforms.type', $platformType) ->findAll(); Loading @@ -88,7 +88,7 @@ class PlatformModel extends Model cache()->save( "podcast{$podcastId}_platforms_{$platformType}", $found, DECADE DECADE, ); } Loading @@ -99,15 +99,15 @@ class PlatformModel extends Model { if ( !($found = cache( "podcast{$podcastId}_podcastPlatforms_{$platformType}" "podcast{$podcastId}_podcastPlatforms_{$platformType}", )) ) { $found = $this->select( 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player' 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player', ) ->join( 'podcasts_platforms', 'podcasts_platforms.platform_slug = platforms.slug' 'podcasts_platforms.platform_slug = platforms.slug', ) ->where('podcasts_platforms.podcast_id', $podcastId) ->where('platforms.type', $platformType) Loading @@ -116,7 +116,7 @@ class PlatformModel extends Model cache()->save( "podcast{$podcastId}_podcastPlatforms_{$platformType}", $found, DECADE DECADE, ); } Loading Loading @@ -173,7 +173,7 @@ EOD; foreach (['podcasting', 'social', 'funding'] as $platformType) { cache()->delete("podcast{$podcastId}_platforms_{$platformType}"); cache()->delete( "podcast{$podcastId}_podcastPlatforms_{$platformType}" "podcast{$podcastId}_podcastPlatforms_{$platformType}", ); } // delete localized podcast page cache Loading @@ -185,7 +185,7 @@ EOD; foreach ($years as $year) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcastId}_{$year['year']}_{$locale}" "page_podcast{$podcastId}_year{$year['year']}_{$locale}", ); } } Loading @@ -193,7 +193,7 @@ EOD; foreach ($seasons as $season) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcastId}_season{$season['season_number']}_{$locale}" "page_podcast{$podcastId}_season{$season['season_number']}_{$locale}", ); } } Loading @@ -202,14 +202,14 @@ EOD; foreach ($podcast->episodes as $episode) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_episode{$episode->id}_{$locale}" "page_podcast{$podcast->id}_episode{$episode->id}_{$locale}", ); foreach ( array_keys(\App\Models\EpisodeModel::$themes) as $themeKey ) { cache()->delete( "page_podcast{$podcast->id}_episode{$episode->id}_embeddable_player_{$themeKey}_{$locale}" "page_podcast{$podcast->id}_episode{$episode->id}_embeddable_player_{$themeKey}_{$locale}", ); } } Loading app/Models/PodcastModel.php +4 −2 Original line number Diff line number Diff line Loading @@ -241,10 +241,12 @@ class PodcastModel extends Model $seasons = $episodeModel->getSeasons($podcast->id); foreach ($years as $year) { cache()->delete("podcast{$podcast->id}_{$year['year']}_episodes"); cache()->delete( "podcast{$podcast->id}_year{$year['year']}_episodes", ); foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_{$year['year']}_{$locale}", "page_podcast{$podcast->id}_year{$year['year']}_{$locale}", ); } } Loading Loading
app/Controllers/Podcast.php +7 −5 Original line number Diff line number Diff line Loading @@ -69,19 +69,21 @@ class Podcast extends BaseController $defaultQuery = (new EpisodeModel())->getDefaultQuery( $this->podcast->id, ); if ($defaultQuery) { if ($defaultQuery['type'] == 'season') { $seasonQuery = $defaultQuery['data']['season_number']; } elseif ($defaultQuery['type'] == 'year') { $yearQuery = $defaultQuery['data']['year']; } } } $cacheName = implode( '_', array_filter([ 'page', "podcast{$this->podcast->id}", $yearQuery, $yearQuery ? 'year' . $yearQuery : null, $seasonQuery ? 'season' . $seasonQuery : null, service('request')->getLocale(), ]), Loading
app/Models/EpisodeModel.php +3 −3 Original line number Diff line number Diff line Loading @@ -314,7 +314,7 @@ class EpisodeModel extends Model * * @param int $podcastId * * @return array * @return array|null */ public function getDefaultQuery(int $podcastId) { Loading Loading @@ -419,11 +419,11 @@ class EpisodeModel extends Model foreach ($years as $year) { cache()->delete( "podcast{$episode->podcast_id}_{$year['year']}_episodes", "podcast{$episode->podcast_id}_year{$year['year']}_episodes", ); foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$episode->podcast_id}_{$year['year']}_{$locale}", "page_podcast{$episode->podcast_id}_year{$year['year']}_{$locale}", ); } } Loading
app/Models/PageModel.php +4 −4 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ class PageModel extends Model protected function clearCache(array $data) { $page = (new PageModel())->find( is_array($data['id']) ? $data['id'][0] : $data['id'] is_array($data['id']) ? $data['id'][0] : $data['id'], ); // delete page cache Loading @@ -57,14 +57,14 @@ class PageModel extends Model foreach ($years as $year) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_{$year['year']}_{$locale}" "page_podcast{$podcast->id}_year{$year['year']}_{$locale}", ); } } foreach ($seasons as $season) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_season{$season['season_number']}_{$locale}" "page_podcast{$podcast->id}_season{$season['season_number']}_{$locale}", ); } } Loading @@ -72,7 +72,7 @@ class PageModel extends Model foreach ($podcast->episodes as $episode) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_episode{$episode->id}_{$locale}" "page_podcast{$podcast->id}_episode{$episode->id}_{$locale}", ); } } Loading
app/Models/PlatformModel.php +18 −18 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class PlatformModel extends Model if (!($found = cache('platforms'))) { $baseUrl = rtrim(config('app')->baseURL, '/'); $found = $this->select( "*, CONCAT('{$baseUrl}/assets/images/platforms/',`type`,'/',`slug`,'.svg') as icon" "*, CONCAT('{$baseUrl}/assets/images/platforms/',`type`,'/',`slug`,'.svg') as icon", )->findAll(); cache()->save('platforms', $found, DECADE); } Loading Loading @@ -75,12 +75,12 @@ class PlatformModel extends Model !($found = cache("podcast{$podcastId}_platforms_{$platformType}")) ) { $found = $this->select( 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player' 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player', ) ->join( 'podcasts_platforms', "podcasts_platforms.platform_slug = platforms.slug AND podcasts_platforms.podcast_id = $podcastId", 'left' 'left', ) ->where('platforms.type', $platformType) ->findAll(); Loading @@ -88,7 +88,7 @@ class PlatformModel extends Model cache()->save( "podcast{$podcastId}_platforms_{$platformType}", $found, DECADE DECADE, ); } Loading @@ -99,15 +99,15 @@ class PlatformModel extends Model { if ( !($found = cache( "podcast{$podcastId}_podcastPlatforms_{$platformType}" "podcast{$podcastId}_podcastPlatforms_{$platformType}", )) ) { $found = $this->select( 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player' 'platforms.*, podcasts_platforms.link_url, podcasts_platforms.link_content, podcasts_platforms.is_visible, podcasts_platforms.is_on_embeddable_player', ) ->join( 'podcasts_platforms', 'podcasts_platforms.platform_slug = platforms.slug' 'podcasts_platforms.platform_slug = platforms.slug', ) ->where('podcasts_platforms.podcast_id', $podcastId) ->where('platforms.type', $platformType) Loading @@ -116,7 +116,7 @@ class PlatformModel extends Model cache()->save( "podcast{$podcastId}_podcastPlatforms_{$platformType}", $found, DECADE DECADE, ); } Loading Loading @@ -173,7 +173,7 @@ EOD; foreach (['podcasting', 'social', 'funding'] as $platformType) { cache()->delete("podcast{$podcastId}_platforms_{$platformType}"); cache()->delete( "podcast{$podcastId}_podcastPlatforms_{$platformType}" "podcast{$podcastId}_podcastPlatforms_{$platformType}", ); } // delete localized podcast page cache Loading @@ -185,7 +185,7 @@ EOD; foreach ($years as $year) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcastId}_{$year['year']}_{$locale}" "page_podcast{$podcastId}_year{$year['year']}_{$locale}", ); } } Loading @@ -193,7 +193,7 @@ EOD; foreach ($seasons as $season) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcastId}_season{$season['season_number']}_{$locale}" "page_podcast{$podcastId}_season{$season['season_number']}_{$locale}", ); } } Loading @@ -202,14 +202,14 @@ EOD; foreach ($podcast->episodes as $episode) { foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_episode{$episode->id}_{$locale}" "page_podcast{$podcast->id}_episode{$episode->id}_{$locale}", ); foreach ( array_keys(\App\Models\EpisodeModel::$themes) as $themeKey ) { cache()->delete( "page_podcast{$podcast->id}_episode{$episode->id}_embeddable_player_{$themeKey}_{$locale}" "page_podcast{$podcast->id}_episode{$episode->id}_embeddable_player_{$themeKey}_{$locale}", ); } } Loading
app/Models/PodcastModel.php +4 −2 Original line number Diff line number Diff line Loading @@ -241,10 +241,12 @@ class PodcastModel extends Model $seasons = $episodeModel->getSeasons($podcast->id); foreach ($years as $year) { cache()->delete("podcast{$podcast->id}_{$year['year']}_episodes"); cache()->delete( "podcast{$podcast->id}_year{$year['year']}_episodes", ); foreach ($supportedLocales as $locale) { cache()->delete( "page_podcast{$podcast->id}_{$year['year']}_{$locale}", "page_podcast{$podcast->id}_year{$year['year']}_{$locale}", ); } } Loading