Make sure podcast times are consistently in the future for unpublished playlist-synced episodes.

This commit is contained in:
Buster Neece 2024-03-22 10:36:14 -05:00
parent c33fd9f30c
commit f7ebe1cd79
No known key found for this signature in database
1 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,7 @@ use App\Entity\Repository\PodcastEpisodeRepository;
use App\Entity\Station;
use App\Entity\StationMedia;
use App\Flysystem\StationFilesystems;
use Carbon\CarbonImmutable;
final class CheckPodcastPlaylistsTask extends AbstractTask
{
@ -121,13 +122,14 @@ final class CheckPodcastPlaylistsTask extends AbstractTask
]))
);
$publishAt = CarbonImmutable::createFromTimestamp($media->getMtime() ?? time(), 'UTC');
if (!$podcast->playlistAutoPublish()) {
// Set a date in the future to unpublish the episode.
$podcastEpisode->setPublishAt(
strtotime('+10 years')
$publishAt->addYears(10)->getTimestamp()
);
} else {
$podcastEpisode->setPublishAt($media->getMtime());
$podcastEpisode->setPublishAt($publishAt->getTimestamp());
}
$this->em->persist($podcastEpisode);