Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2106 from tomaszdurka/archive-not-found-fix
Browse files Browse the repository at this point in the history
Ignore archive-not-found with no stream channels
  • Loading branch information
tomaszdurka committed Mar 24, 2016
2 parents 41b040a + 28f5b41 commit 2687fea
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions library/CM/MediaStreams/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
class CM_MediaStreams_Cli extends CM_Cli_Runnable_Abstract {

/**
* @param string $streamChannelMediaId
* @param string $streamChannelMediaId
* @param CM_File $thumbnailSource
* @param int $createStamp
* @param int $createStamp
* @throws CM_Exception
* @throws CM_Exception_Invalid
*/
Expand All @@ -31,15 +31,21 @@ public function importVideoThumbnail($streamChannelMediaId, CM_File $thumbnailSo
}

/**
* @param string $streamChannelMediaId
* @param string $streamChannelMediaId
* @param CM_File $archiveSource
* @throws CM_Exception_Invalid
*/
public function importArchive($streamChannelMediaId, CM_File $archiveSource) {
$streamChannelMediaId = (string) $streamChannelMediaId;
$streamChannelArchive = CM_Model_StreamChannelArchive_Media::findByMediaId($streamChannelMediaId);
if (!$streamChannelArchive) {
throw new CM_Exception_Invalid('Archive not found', null, ['streamChannelMediaId' => $streamChannelMediaId]);
$streamChannel = CM_Model_StreamChannel_Media::findByMediaId($streamChannelMediaId);
if ($streamChannel) {
throw new CM_Exception_Invalid('Archive not created, please try again later', null, ['streamChannelMediaId' => $streamChannelMediaId]);
}
$exception = new CM_Exception_Invalid('Archive not found, stream channel not found, skipping', CM_Exception::WARN, ['streamChannelMediaId' => $streamChannelMediaId]);
CM_Bootloader::getInstance()->getExceptionHandler()->logException($exception);
return;
}
$filename = $streamChannelArchive->getId() . '-' . $streamChannelArchive->getHash() . '-original.' . $archiveSource->getExtension();
$archiveDestination = new CM_File_UserContent('streamChannels', $filename, $streamChannelArchive->getId());
Expand Down

0 comments on commit 2687fea

Please sign in to comment.