mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-14 12:07:46 +02:00
fix(analytics): update service management so that it works with new OPAWG slug values
This commit is contained in:
parent
8b3c689f86
commit
7fe9d42500
10 changed files with 441 additions and 150 deletions
|
|
@ -23,22 +23,24 @@ class Feed extends Controller
|
|||
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
$service = null;
|
||||
$serviceSlug = '';
|
||||
try {
|
||||
$service = \Opawg\UserAgentsPhp\UserAgentsRSS::find(
|
||||
$_SERVER['HTTP_USER_AGENT']
|
||||
);
|
||||
if ($service) {
|
||||
$serviceSlug = $service['slug'];
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// If things go wrong the show must go on and the user must be able to download the file
|
||||
log_message('critical', $e);
|
||||
}
|
||||
|
||||
$cacheName =
|
||||
"podcast{$podcast->id}_feed" .
|
||||
($service ? "_{$service['slug']}" : '');
|
||||
"podcast{$podcast->id}_feed" . ($service ? "_{$serviceSlug}" : '');
|
||||
|
||||
if (!($found = cache($cacheName))) {
|
||||
$found = get_rss_feed($podcast, $service ? $service['name'] : '');
|
||||
$found = get_rss_feed($podcast, $serviceSlug);
|
||||
|
||||
// The page cache is set to expire after next episode publication or a decade by default so it is deleted manually upon podcast update
|
||||
$secondsToNextUnpublishedEpisode = (new EpisodeModel())->getSecondsToNextUnpublishedEpisode(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue