Exemplo n.º 1
0
 /**
  * @param int $entryId
  */
 public static function boostEntryJobs($entryId)
 {
     $entrydb = entryPeer::retrieveByPK($entryId);
     if (!$entrydb) {
         throw new APIException(APIErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     //Retrieve all batch jobs associated to the entry
     $batchJobs = BatchJobLockPeer::retrieveByEntryId($entryId);
     foreach ($batchJobs as $job) {
         /* @var $job BatchJobLock */
         //Boost the job by setting priority and urjeny to 1
         $job->setPriority(1);
         $job->setUrgency(1);
     }
 }
Exemplo n.º 2
0
 public static function deleteEntry(entry $entry, $partner_id = null, $onlyIfAllJobsDone = false)
 {
     if ($entry->getStatus() == entryStatus::DELETED || $entry->getStatus() == entryStatus::BLOCKED) {
         return;
     }
     // don't do this twice !
     if ($onlyIfAllJobsDone) {
         $dbEntryBatchJobLocks = BatchJobLockPeer::retrieveByEntryId($entry->getId());
         foreach ($dbEntryBatchJobLocks as $jobLock) {
             /* @var $jobLock BatchJobLock */
             KalturaLog::info("Entry [" . $entry->getId() . "] still has an unhandled batchjob [" . $jobLock->getId() . "] with status [" . $jobLock->getStatus() . "] - aborting deletion process.");
             //mark entry for later deletion
             $entry->setMarkedForDeletion(true);
             $entry->save();
             return;
         }
     }
     KalturaLog::log("myEntryUtils::delete Entry [" . $entry->getId() . "] Partner [" . $entry->getPartnerId() . "]");
     kJobsManager::abortEntryJobs($entry->getId());
     $media_type = $entry->getMediaType();
     $need_to_fix_roughcut = false;
     $thumb_template_file = "&deleted_image.jpg";
     KalturaLog::log("media type [{$media_type}]");
     switch ($media_type) {
         case entry::ENTRY_MEDIA_TYPE_AUDIO:
             $template_file = "&deleted_audio.flv";
             $need_to_fix_roughcut = true;
             break;
         case entry::ENTRY_MEDIA_TYPE_IMAGE:
             $template_file = "&deleted_image.jpg";
             $need_to_fix_roughcut = false;
             // no need to add a batch job for images
             break;
         case entry::ENTRY_MEDIA_TYPE_VIDEO:
             $template_file = "&deleted_video.flv";
             $need_to_fix_roughcut = true;
             break;
         case entry::ENTRY_MEDIA_TYPE_SHOW:
         default:
             $template_file = "&deleted_rc.xml";
             $need_to_fix_roughcut = false;
             break;
     }
     if ($entry->getType() == entryType::LIVE_STREAM) {
         kJobsManager::addProvisionDeleteJob(null, $entry);
     }
     // in this case we'll need some batch job to fix all related roughcuts for this entry
     // use the batch_job mechanism to indicate there is a deleted entry to handle
     if ($need_to_fix_roughcut) {
         //			Should use a different job type
         //			BatchJob::createDeleteEntryJob ( $entry );
     }
     $entry->putInCustomData("deleted_original_data", $entry->getData());
     $entry->putInCustomData("deleted_original_thumb", $entry->getThumbnail());
     $content_path = myContentStorage::getFSContentRootPath();
     //		Remarked by Tan-Tan 27/09/2010
     //		Handled by kObjectDeleteHandler
     //		$currentDataKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA); // replaced__getDataPath
     //		$currentDataEditKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT); // replaced__getDataPathEdit
     //		$currentThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB); // replaced__getThumbnailPath
     $entry->setData($entry->getData());
     // once to increment the verions
     $entry->setData($template_file);
     // the other to set the template
     $entry->setThumbnail($entry->getThumbnail());
     // once to increment the verions
     $entry->setThumbnail($thumb_template_file);
     // the other to set the template
     //		Remarked by Tan-Tan 27/09/2010
     //		Handled by kObjectDeleteHandler
     //		// move file so there will be no access to it
     //		$deleted_content = kFileSyncUtils::deleteSyncFileForKey($currentDataKey);
     //		$deleted_content .= "|" . kFileSyncUtils::deleteSyncFileForKey($currentDataEditKey,false); // for some entries there may not be an edit version
     //		$deleted_content .= "|" . kFileSyncUtils::deleteSyncFileForKey($currentThumbKey,false); // for some entries (empty mix / audio) there may not be a thumb FileSync
     //		Remarked by Tan-Tan 27/09/2010
     //		$deleted_content is always null anyway
     //		$entry->putInCustomData( "deleted_file_path" , $deleted_content ? $deleted_content : serialize($currentDataKey) ) ;
     $entry->setStatus(entryStatus::DELETED);
     //$entry->setCategories("");
     // make sure the moderation_status is set to moderation::MODERATION_STATUS_DELETE
     $entry->setModerationStatus(moderation::MODERATION_STATUS_DELETE);
     $entry->setModifiedAt(time());
     $entry->save();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_DELETE, $entry, null, null, null, null, $entry->getId());
 }