SAAS-1081 - implement station podcast download counter that resets monthly
This commit is contained in:
parent
6c0055895c
commit
92ffa955c3
7 changed files with 94 additions and 23 deletions
|
@ -63,11 +63,17 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// In case the download fails
|
||||
$counterIncremented = false;
|
||||
try {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200);
|
||||
$inline = false;
|
||||
// SAAS-1081
|
||||
if ($key = $this->getRequest()->getParam("download_key", false)) {
|
||||
Application_Model_Preference::incrementStationPodcastDownloadCounter();
|
||||
$counterIncremented = true;
|
||||
}
|
||||
Application_Service_MediaService::streamFileDownload($id, $inline);
|
||||
}
|
||||
catch (FileNotFoundException $e) {
|
||||
|
@ -75,6 +81,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
Logging::error($e->getMessage());
|
||||
}
|
||||
catch (Exception $e) {
|
||||
if ($counterIncremented) Application_Model_Preference::decrementStationPodcastDownloadCounter();
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue