Set auto ingest timestamp when updating
This commit is contained in:
parent
0b1df6baf3
commit
6c0055895c
|
@ -30,7 +30,7 @@ class PodcastManager {
|
||||||
$service = new Application_Service_PodcastEpisodeService();
|
$service = new Application_Service_PodcastEpisodeService();
|
||||||
foreach ($autoIngestPodcasts as $podcast) {
|
foreach ($autoIngestPodcasts as $podcast) {
|
||||||
$episodes = static::_findUningestedEpisodes($podcast, $service);
|
$episodes = static::_findUningestedEpisodes($podcast, $service);
|
||||||
$podcast->setDbAutoIngestTimestamp(date('r'))->save();
|
$podcast->setDbAutoIngestTimestamp(gmdate('r'))->save();
|
||||||
$service->downloadEpisodes($episodes);
|
$service->downloadEpisodes($episodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,6 +309,7 @@ class Application_Service_PodcastService
|
||||||
|
|
||||||
self::removePrivateFields($data["podcast"]);
|
self::removePrivateFields($data["podcast"]);
|
||||||
self::validatePodcastMetadata($data["podcast"]);
|
self::validatePodcastMetadata($data["podcast"]);
|
||||||
|
self::_updateAutoIngestTimestamp($podcast, $data);
|
||||||
|
|
||||||
$podcast->fromArray($data["podcast"], BasePeer::TYPE_FIELDNAME);
|
$podcast->fromArray($data["podcast"], BasePeer::TYPE_FIELDNAME);
|
||||||
$podcast->save();
|
$podcast->save();
|
||||||
|
@ -316,6 +317,21 @@ class Application_Service_PodcastService
|
||||||
return $podcast->toArray(BasePeer::TYPE_FIELDNAME);
|
return $podcast->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the automatic ingestion timestamp for the given Podcast
|
||||||
|
*
|
||||||
|
* @param Podcast $podcast Podcast object to update
|
||||||
|
* @param array $data Podcast update data array
|
||||||
|
*/
|
||||||
|
private static function _updateAutoIngestTimestamp($podcast, $data) {
|
||||||
|
// Get podcast data with lazy loaded columns since we can't directly call getDbAutoIngest()
|
||||||
|
$currData = $podcast->toArray(BasePeer::TYPE_FIELDNAME, true);
|
||||||
|
// Add an auto-ingest timestamp when turning auto-ingest on
|
||||||
|
if ($data["podcast"]["auto_ingest"] == 1 && $currData["auto_ingest"] != 1) {
|
||||||
|
$data["podcast"]["auto_ingest_timestamp"] = gmdate('r');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static function removePrivateFields(&$data)
|
private static function removePrivateFields(&$data)
|
||||||
{
|
{
|
||||||
foreach (self::$privateFields as $key) {
|
foreach (self::$privateFields as $key) {
|
||||||
|
|
Loading…
Reference in New Issue