コード例 #1
0
ファイル: kFlowManager.php プロジェクト: DBezemer/server
 public function objectReadyForReplacment(BaseObject $object, BatchJob $raisedJob = null)
 {
     $entry = entryPeer::retrieveByPK($object->getReplacedEntryId());
     if (!$entry) {
         KalturaLog::err("Real entry id [" . $object->getReplacedEntryId() . "] not found");
         return true;
     }
     kBusinessConvertDL::replaceEntry($entry, $object);
     return true;
 }
コード例 #2
0
 /**
  * Approves entry replacement
  *
  * @param string $entryId entry id to replace
  * @param KalturaEntryType $entryType the entry type
  * @return KalturaMediaEntry The replaced media entry
  *
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  */
 protected function approveReplace($entryId, $entryType)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || $dbEntry->getType() != $entryType) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     switch ($dbEntry->getReplacementStatus()) {
         case entryReplacementStatus::APPROVED_BUT_NOT_READY:
             break;
         case entryReplacementStatus::READY_BUT_NOT_APPROVED:
             kBusinessConvertDL::replaceEntry($dbEntry);
             break;
         case entryReplacementStatus::NOT_READY_AND_NOT_APPROVED:
             $dbEntry->setReplacementStatus(entryReplacementStatus::APPROVED_BUT_NOT_READY);
             $dbEntry->save();
             //preventing race conditions of temp entry being ready just as you approve the replacement
             $dbReplacingEntry = entryPeer::retrieveByPK($dbEntry->getReplacingEntryId());
             if ($dbReplacingEntry && $dbReplacingEntry->getStatus() == entryStatus::READY) {
                 kBusinessConvertDL::replaceEntry($dbEntry);
             }
             break;
         case entryReplacementStatus::NONE:
         case entryReplacementStatus::FAILED:
         default:
             throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_REPLACED, $entryId);
             break;
     }
     return $this->getEntry($entryId, -1, $entryType);
 }
コード例 #3
0
 /**
  * Approves media replacement
  *
  * @action approveReplace
  * @param string $entryId Media entry id to replace
  * @return KalturaMediaEntry The replaced media entry
  * 
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  */
 function approveReplaceAction($entryId)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::MEDIA_CLIP) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     switch ($dbEntry->getReplacementStatus()) {
         case entryReplacementStatus::APPROVED_BUT_NOT_READY:
             break;
         case entryReplacementStatus::READY_BUT_NOT_APPROVED:
             kBusinessConvertDL::replaceEntry($dbEntry);
             break;
         case entryReplacementStatus::NOT_READY_AND_NOT_APPROVED:
             $dbEntry->setReplacementStatus(entryReplacementStatus::APPROVED_BUT_NOT_READY);
             $dbEntry->save();
             break;
         case entryReplacementStatus::NONE:
         default:
             throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_REPLACED, $entryId);
             break;
     }
     return $this->getEntry($entryId, -1, KalturaEntryType::MEDIA_CLIP);
 }