Make sure podcast times are consistently in the future for unpublished playlist-synced episodes.
This commit is contained in:
parent
c33fd9f30c
commit
f7ebe1cd79
|
@ -11,6 +11,7 @@ use App\Entity\Repository\PodcastEpisodeRepository;
|
||||||
use App\Entity\Station;
|
use App\Entity\Station;
|
||||||
use App\Entity\StationMedia;
|
use App\Entity\StationMedia;
|
||||||
use App\Flysystem\StationFilesystems;
|
use App\Flysystem\StationFilesystems;
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
|
|
||||||
final class CheckPodcastPlaylistsTask extends AbstractTask
|
final class CheckPodcastPlaylistsTask extends AbstractTask
|
||||||
{
|
{
|
||||||
|
@ -121,13 +122,14 @@ final class CheckPodcastPlaylistsTask extends AbstractTask
|
||||||
]))
|
]))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$publishAt = CarbonImmutable::createFromTimestamp($media->getMtime() ?? time(), 'UTC');
|
||||||
if (!$podcast->playlistAutoPublish()) {
|
if (!$podcast->playlistAutoPublish()) {
|
||||||
// Set a date in the future to unpublish the episode.
|
// Set a date in the future to unpublish the episode.
|
||||||
$podcastEpisode->setPublishAt(
|
$podcastEpisode->setPublishAt(
|
||||||
strtotime('+10 years')
|
$publishAt->addYears(10)->getTimestamp()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$podcastEpisode->setPublishAt($media->getMtime());
|
$podcastEpisode->setPublishAt($publishAt->getTimestamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->em->persist($podcastEpisode);
|
$this->em->persist($podcastEpisode);
|
||||||
|
|
Loading…
Reference in New Issue