Improve the publish service implementation

This commit is contained in:
Duncan Sommerville 2015-11-16 16:18:29 -05:00
parent 42e55f193c
commit 7707378c2b
5 changed files with 59 additions and 45 deletions

View file

@ -215,6 +215,22 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
->delete();
}
/**
* Fetch the publication status for the file with the given ID
*
* @param int $fileId the ID of the file to check
*
* @return int 1 if the file has been published,
* 0 if the file has yet to be published,
* -1 if the file is in a pending state,
* 2 if the source is unreachable (disconnected)
*/
public function getPublishStatus($fileId) {
$stationPodcast = StationPodcastQuery::create()
->findOneByDbPodcastId(Application_Model_Preference::getStationPodcastId());
return (int) $stationPodcast->hasEpisodeForFile($fileId);
}
/**
* @param $episodeId
* @return array