private function getAccessControlScope()
 {
     $scope = new accessControlScope();
     if ($this->referrer) {
         $scope->setReferrer($this->referrer);
     }
     $scope->setKs($this->ks);
     $scope->setEntryId($this->entry->getId());
     $scope->setContexts($this->contexts);
     return $scope;
 }
 /**
  * Executes addComment action, which returns a form enabling the insertion of a comment
  * The request may include 1 fields: entry id.
  */
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     $version = @$_REQUEST["version"];
     // it's a path on the disk
     if (kString::beginsWith($version, ".")) {
         // someone is trying to hack in the system
         return sfView::ERROR;
     }
     // in case we're making a roughcut out of a regular invite, we start from scratch
     if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW || $entry->getDataPath($version) === null) {
         $this->xml_content = "<xml></xml>";
         return;
     }
     // fetch content of file from disk - it should hold the XML
     $file_name = myContentStorage::getFSContentRootPath() . "/" . $entry->getDataPath($version);
     //echo "[$file_name]";
     if (kString::endsWith($file_name, "xml")) {
         if (file_exists($file_name)) {
             $this->xml_content = kFile::getFileContent($file_name);
             //	echo "[" . $this->xml_content . "]" ;
         } else {
             $this->xml_content = "<xml></xml>";
         }
         myMetadataUtils::updateEntryForPending($entry, $version, $this->xml_content);
     } else {
         return sfView::ERROR;
     }
     // this is NOT an xml file we are looking for !
 }
 /**
  * @param entry $entry
  * @param SimpleXMLElement $mrss
  * @return SimpleXMLElement
  */
 public function contribute(entry $entry, SimpleXMLElement $mrss)
 {
     $metadatas = MetadataPeer::retrieveAllByObject(Metadata::TYPE_ENTRY, $entry->getId());
     foreach ($metadatas as $metadata) {
         $this->contributeMetadata($metadata, $mrss);
     }
 }
 /**
  * @param entry $object
  * @return bool true if should continue to the next consumer
  */
 public function entryCreated(entry $object)
 {
     $mediaType = null;
     if ($object->getType() == entryType::AUTOMATIC) {
         $mediaType = $object->getMediaType();
         if (isset(self::$fileExtensions[$mediaType])) {
             $object->setType(entryType::DOCUMENT);
         } elseif (is_null($mediaType) || $mediaType == entry::ENTRY_MEDIA_TYPE_ANY || $mediaType == entry::ENTRY_MEDIA_TYPE_AUTOMATIC) {
             $this->setDocumentType($object);
         }
     }
     if ($object->getType() != entryType::DOCUMENT) {
         KalturaLog::info("entry id [" . $object->getId() . "] type [" . $object->getType() . "]");
         return true;
     }
     if (is_null($mediaType) || $mediaType == entry::ENTRY_MEDIA_TYPE_ANY || $mediaType == entry::ENTRY_MEDIA_TYPE_AUTOMATIC) {
         $this->setDocumentType($object);
     }
     if ($object instanceof DocumentEntry) {
         KalturaLog::info("entry id [" . $object->getId() . "] already handled");
         return true;
     }
     if ($object->getConversionProfileId()) {
         $object->setStatus(entryStatus::PRECONVERT);
         $object->save();
     }
     return true;
 }
Example #5
0
 public function copyAssets(entry $toEntry, ThumbCuePoint $toCuePoint, $adjustedStartTime = null)
 {
     $timedThumbAsset = assetPeer::retrieveById($this->getAssetId());
     if (!$timedThumbAsset) {
         KalturaLog::debug("Can't retrieve timedThumbAsset with id: {$this->getAssetId()}");
         return;
     }
     // Offset the startTime according to the duration gap between the live and VOD entries
     if (!is_null($adjustedStartTime)) {
         $toCuePoint->setStartTime($adjustedStartTime);
     }
     $toCuePoint->save();
     // Must save in order to produce an id
     $timedThumbAsset->setCuePointID($toCuePoint->getId());
     // Set the destination cue point's id
     $timedThumbAsset->setCustomDataObj();
     // Write the cached custom data object into the thumb asset
     // Make a copy of the current thumb asset
     // copyToEntry will create a filesync softlink to the original filesync
     $toTimedThumbAsset = $timedThumbAsset->copyToEntry($toEntry->getId(), $toEntry->getPartnerId());
     $toCuePoint->setAssetId($toTimedThumbAsset->getId());
     $toCuePoint->save();
     // Restore the thumb asset's prev. cue point id (for good measures)
     $timedThumbAsset->setCuePointID($this->getId());
     $timedThumbAsset->setCustomDataObj();
     // Save the destination entry's thumb asset
     $toTimedThumbAsset->setCuePointID($toCuePoint->getId());
     $toTimedThumbAsset->save();
     KalturaLog::log("Saved cue point [{$toCuePoint->getId()}] and timed thumb asset [{$toTimedThumbAsset->getId()}]");
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $prefix = $this->getObjectPrefix();
     $entry_id = $this->getPM("{$prefix}_id");
     $detailed = false;
     //$this->getP ( "detailed" , false );
     $version = $this->getP("version", false);
     $entry = new entry();
     $entry->setId($entry_id);
     /*		
     	$c = $this->getCriteria(); 
     	if ( $c == null )
     	{
     		$entry = entryPeer::retrieveByPK( $entry_id );
     	}
     	else
     	{
     		$c->add ( entryPeer::ID , $entry_id );
     		$entry = entryPeer::doSelectOne( $c );
     	}
     */
     if (!$entry) {
         $this->addError(APIErrors::INVALID_ENTRY_ID, $prefix, $entry_id);
     } else {
         $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
         $roughcuts = $entry->getRoughcuts();
         $this->addMsg("count", count($roughcuts));
         $this->addMsg("roughcuts", objectWrapperBase::getWrapperClass($roughcuts, $level));
     }
 }
 /**
  * @param entry $entry
  * @param SimpleXMLElement $mrss
  * @return SimpleXMLElement
  */
 public function contribute(entry $entry, SimpleXMLElement $mrss)
 {
     $entryDistributions = EntryDistributionPeer::retrieveByEntryId($entry->getId());
     foreach ($entryDistributions as $entryDistribution) {
         $this->contributeDistribution($entryDistribution, $mrss);
     }
 }
Example #8
0
 /**
  * @param entry $entry
  * @return bool true if cuepoints should be copied to given entry
  */
 public function hasPermissionToCopyToEntry(entry $entry)
 {
     if (!$entry->getIsTemporary() && PermissionPeer::isValidForPartner(AnnotationCuePointPermissionName::COPY_ANNOTATIONS_TO_CLIP, $entry->getPartnerId())) {
         return true;
     }
     if ($entry->getIsTemporary() && !PermissionPeer::isValidForPartner(AnnotationCuePointPermissionName::DO_NOT_COPY_ANNOTATIONS_TO_TRIMMED_ENTRY, $entry->getPartnerId())) {
         return true;
     }
     return false;
 }
 public function getBroadcastUrl(entry $entry, $mediaServerIndex)
 {
     $mediaServerConfig = kConf::get($mediaServerIndex, 'broadcast');
     $app = $mediaServerConfig['application'];
     $partnerId = $this->partnerId;
     $url = "rtmp://{$partnerId}.{$mediaServerIndex}." . kConf::get('domain', 'broadcast');
     $entryId = $entry->getId();
     $token = $entry->getStreamPassword();
     return "{$url}/{$app}/p/{$partnerId}/e/{$entryId}/i/{$mediaServerIndex}/t/{$token}";
 }
 private static function purgeEntryFromEdgeCast(entry $entry)
 {
     // get partner
     $partnerId = $entry->getPartnerId();
     $partner = PartnerPeer::retrieveByPK($partnerId);
     if (!$partner) {
         KalturaLog::err('Cannot find partner with id [' . $partnerId . ']');
         return false;
     }
     $mediaTypePathList = array(array('MediaType' => self::EDGE_SERVICE_HTTP_LARGE_OBJECT_MEDIA_TYPE, 'MediaPath' => $entry->getDownloadUrl()), array('MediaType' => self::EDGE_SERVICE_HTTP_SMALL_OBJECT_MEDIA_TYPE, 'MediaPath' => $entry->getThumbnailUrl()));
     return self::purgeFromEdgeCast($mediaTypePathList, $partner);
 }
Example #11
0
 /**
  * This function checks if the entry type matches the filter, and return 'true' or 'false' accordingly.
  * @param entry $entry
  * @return boolean
  */
 public function matches(entry $entry)
 {
     // check if type equals
     if ($entry->getType() == $this->get('_eq_type')) {
         return true;
     }
     // check if type in
     if (in_array($entry->getType(), explode(',', $this->get('_in_type')))) {
         return true;
     }
     return false;
 }
Example #12
0
 public function toObject($dbDataEntry = null, $propsToSkip = array())
 {
     if (is_null($dbDataEntry)) {
         $dbDataEntry = new entry();
     }
     if ($this->retrieveDataContentByGet === null) {
         $this->retrieveDataContentByGet = 1;
     }
     //$dbDataEntry->putInCustomData('retrieveDataContentByGet',$this->retrieveDataContentByGet);
     $dbDataEntry->setRetrieveDataContentByGet($this->retrieveDataContentByGet);
     return parent::toObject($dbDataEntry, $propsToSkip);
 }
 function load_new()
 {
     $this->load_read();
     $pid = $_SESSION['userid'];
     $query = 'select
           forum_relation.level, 
           forum.id,
           forum.rel_to,
           forum.author, 
           person.first_name as author_first_name, 
           person.last_name as author_last_name, 
           forum.created, 
           forum.topic, 
           forum.text, 
           rights_person.rights as rights_person, 
           pg.gid, 
           rights_group.rights as rights_group 
          from forum_relation
          left join forum on
           forum_relation.answer=forum.id 
          left join person on
           forum.author=person.id 
          left join forum_rights_person as rights_person on
           forum.id=rights_person.entry_id 
           and rights_person.person_id="' . $pid . '" 
          left join forum_rights_group as rights_group on
           rights_person.rights is null 
           and forum.id=rights_group.entry_id 
          left join pg on
           rights_group.group_id=pg.gid 
           and pg.pid="' . $pid . '" 
          where
            forum.created>"' . $_SESSION['last_login'] . '"';
     $query .= 'order by
           forum_relation.level,
           forum.created';
     $result = $this->db->query($query);
     while ($data = mysql_fetch_array($result)) {
         $level = $data['level'];
         $id = $data['id'];
         $entry =& $this->entries[$id];
         if (!isset($entry)) {
             $entry = new entry();
             $entry->set_data($data);
             if (!isset($this->read[$id])) {
                 $entry->new = true;
             }
         }
         $entry->add_rights_row($data);
     }
     $this->index_new();
 }
Example #14
0
 public static function calculateExpirationDate(DrmPolicy $policy, entry $entry)
 {
     $beginDate = time();
     switch ($policy->getLicenseExpirationPolicy()) {
         case DrmLicenseExpirationPolicy::FIXED_DURATION:
             $expirationDate = $beginDate + dateUtils::DAY * $policy->getDuration();
             break;
         case DrmLicenseExpirationPolicy::ENTRY_SCHEDULING_END:
             $expirationDate = $entry->getEndDate();
             break;
     }
     return $expirationDate;
 }
Example #15
0
 protected function handleEntry($context, $feed, entry $entry, Entrydistribution $entryDistribution)
 {
     $fields = $this->profile->getAllFieldValues($entryDistribution);
     $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
     $flavorAsset = reset($flavorAssets);
     $flavorAssetRemoteUrl = $entryDistribution->getFromCustomData(UverseEntryDistributionCustomDataField::REMOTE_ASSET_URL);
     $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds()));
     $xml = $feed->getItemXml($fields, $flavorAsset, $flavorAssetRemoteUrl, $thumbAssets);
     // we want to find the newest update time between all entries
     if ($entry->getUpdatedAt(null) > $context->lastBuildDate) {
         $context->lastBuildDate = $entry->getUpdatedAt(null);
     }
     return $xml;
 }
Example #16
0
 public function toObject($dbObject = null, $skip = array())
 {
     if (is_null($dbObject)) {
         $dbObject = new entry();
     }
     // support filters array only if atleast one filters was specified
     if ($this->playlistType == KalturaPlaylistType::DYNAMIC && $this->filters && $this->filters->count > 0) {
         $this->filtersToPlaylistContentXml();
     }
     $dbObject->setType(entryType::PLAYLIST);
     parent::toObject($dbObject);
     $dbObject->setType(entryType::PLAYLIST);
     $dbObject->setDataContent($this->playlistContent);
     return $dbObject;
 }
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     $this->res = "";
     $likuser_id = $this->getLoggedInUserId();
     if ($likuser_id != $entry->getKuserId()) {
         // ERROR - attempting to update an entry which doesnt belong to the user
         return "<xml>!</xml>";
         //$this->securityViolation( $kshow->getId() );
     }
     $name = @$_GET["RoughcutName"];
     $entry->setName($name);
     $entry->save();
     //myEntryUtils::createWidgetImage($entry, false);
     $this->name = $name;
 }
Example #18
0
 public function syncEntryEntitlementInfo(entry $vodEntry, LiveEntry $liveEntry)
 {
     $entitledPusersEdit = $liveEntry->getEntitledPusersEdit();
     $entitledPusersPublish = $liveEntry->getEntitledPusersPublish();
     if (!$entitledPusersEdit && !$entitledPusersPublish) {
         return;
     }
     if ($entitledPusersEdit) {
         $vodEntry->setEntitledPusersEdit($entitledPusersEdit);
     }
     if ($entitledPusersPublish) {
         $vodEntry->setEntitledPusersPublish($entitledPusersPublish);
     }
     $vodEntry->save();
 }
Example #19
0
 private function fixIsmManifestForReplacedEntry($path)
 {
     $fileData = file_get_contents($path);
     $xml = new SimpleXMLElement($fileData);
     $ismcFileName = $xml->head->meta['content'];
     list($ismcObjectId, $version, $subType, $isAsset, $entryId) = $this->parseObjectId($ismcFileName);
     if ($entryId != $this->entry->getId()) {
         //replacement flow
         $flavorAssets = assetPeer::retrieveByEntryIdAndStatus($this->entry->getId(), asset::ASSET_STATUS_READY);
         foreach ($flavorAssets as $asset) {
             if ($asset->hasTag(assetParams::TAG_ISM_MANIFEST)) {
                 list($replacingFileName, $fileName) = $this->getReplacedAndReplacingFileNames($asset, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
                 if ($replacingFileName && $fileName) {
                     $fileData = str_replace("content=\"{$replacingFileName}\"", "content=\"{$fileName}\"", $fileData);
                 }
             } else {
                 list($replacingFileName, $fileName) = $this->getReplacedAndReplacingFileNames($asset, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
                 if ($replacingFileName && $fileName) {
                     $fileData = str_replace("src=\"{$replacingFileName}\"", "src=\"{$fileName}\"", $fileData);
                 }
             }
         }
         return $fileData;
     } else {
         return $fileData;
     }
 }
 private function createPlayManifestURLs(KalturaEntryDistribution $entryDistribution, entry $entry, TvinciDistributionFeedHelper $feedHelper)
 {
     $distributionFlavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->flavorAssetIds));
     $videoAssetDataMap = $this->getVideoAssetDataMap();
     foreach ($videoAssetDataMap as $videoAssetData) {
         $tvinciAssetName = $videoAssetData[0];
         $playbackProtocol = $videoAssetData[1];
         $tags = $videoAssetData[2];
         $fileExt = $videoAssetData[3];
         $keys = array();
         $relevantTags = array();
         foreach ($distributionFlavorAssets as $distributionFlavorAsset) {
             foreach ($tags as $tag) {
                 if ($distributionFlavorAsset->isLocalReadyStatus() && $distributionFlavorAsset->hasTag($tag)) {
                     $key = $this->createFileCoGuid($entry->getEntryId(), $distributionFlavorAsset->getFlavorParamsId());
                     if (!in_array($key, $keys)) {
                         $keys[] = $key;
                     }
                     if (!in_array($tag, $relevantTags)) {
                         $relevantTags[] = $tag;
                     }
                 }
             }
         }
         if ($keys) {
             $fileCoGuid = implode(",", $keys);
             $tagFlag = implode(",", $relevantTags);
             $url = $this->getPlayManifestUrl($entry, $playbackProtocol, $tagFlag, $fileExt);
             $feedHelper->setVideoAssetData($tvinciAssetName, $url, $fileCoGuid);
         }
     }
 }
 /**
  * @param entry $entry
  */
 protected function entryDeleted(entry $entry)
 {
     $this->syncableDeleted($entry->getId(), FileSyncObjectType::ENTRY);
     // delete flavor assets
     $c = new Criteria();
     $c->add(assetPeer::ENTRY_ID, $entry->getId());
     $c->add(assetPeer::STATUS, asset::FLAVOR_ASSET_STATUS_DELETED, Criteria::NOT_EQUAL);
     $c->add(assetPeer::DELETED_AT, null, Criteria::ISNULL);
     $assets = assetPeer::doSelect($c);
     foreach ($assets as $asset) {
         $asset->setStatus(asset::FLAVOR_ASSET_STATUS_DELETED);
         $asset->setDeletedAt(time());
         $asset->save();
     }
     $c = new Criteria();
     $c->add(assetParamsOutputPeer::ENTRY_ID, $entry->getId());
     $c->add(assetParamsOutputPeer::DELETED_AT, null, Criteria::ISNULL);
     $flavorParamsOutputs = assetParamsOutputPeer::doSelect($c);
     foreach ($flavorParamsOutputs as $flavorParamsOutput) {
         $flavorParamsOutput->setDeletedAt(time());
         $flavorParamsOutput->save();
     }
     $filter = new categoryEntryFilter();
     $filter->setEntryIdEqaul($entry->getId());
     kJobsManager::addDeleteJob($entry->getPartnerId(), DeleteObjectType::CATEGORY_ENTRY, $filter);
 }
Example #22
0
 protected function handleEntry($context, $feed, entry $entry, Entrydistribution $entryDistribution)
 {
     $fields = $this->profile->getAllFieldValues($entryDistribution);
     $flavorAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getFlavorAssetIds()));
     $thumbAssets = assetPeer::retrieveByIds(explode(',', $entryDistribution->getThumbAssetIds()));
     $captionAssets = null;
     if ($this->profile instanceof ComcastMrssDistributionProfile && $this->profile->getShouldIncludeCaptions()) {
         KalturaLog::info("Adding entry captions.");
         $captionAssets = $this->getCaptions($entry->getPartnerId(), $entry->getId());
     }
     $cuePoints = null;
     if ($this->profile instanceof ComcastMrssDistributionProfile && $this->profile->getShouldIncludeCuePoints()) {
         KalturaLog::info("Adding entry cue points.");
         $cuePoints = $this->getCuePoints($entry->getPartnerId(), $entry->getId());
     }
     return $feed->getItemXml($fields, $flavorAssets, $thumbAssets, $captionAssets, $cuePoints);
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("detailed", false);
     // fill the playlist (infact only the mediaType and contentData are important
     $playlist = new entry();
     $playlist->setType(entryType::PLAYLIST);
     // prepare the playlist type before filling from request
     $obj_wrapper = objectWrapperBase::getWrapperClass($playlist, 0);
     $playlist->setMediaType($this->getP("playlist_mediaType"));
     $data_content = $this->getP("playlist_dataContent");
     $playlist->setDataContent($data_content);
     myPlaylistUtils::updatePlaylistStatistics($partner_id, $playlist);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $wrapper = objectWrapperBase::getWrapperClass($playlist, $level);
     $this->addMsg("playlist", $wrapper);
 }
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_SHOW) {
         $this->show_versions = array_reverse($entry->getAllversions());
     } else {
         $this->show_versions = array();
     }
     $this->producer = kuser::getKuserById($kshow->getProducerId());
     $this->editor = $entry->getKuser();
     $this->thumbnail = $entry ? $entry->getThumbnailPath() : "";
     // is the logged-in-user is an admin or the producer or the show can always be published...
     $likuser_id = $this->getLoggedInUserId();
     $viewer_type = myKshowUtils::getViewerType($kshow, $likuser_id);
     $this->entry = $entry ? $entry : new entry();
     // create a dummy entry for the GUI
     $this->can_publish = $viewer_type == KshowKuser::KSHOWKUSER_VIEWER_PRODUCER || $kshow->getCanPublish();
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("detailed", false);
     if (!$detailed) {
         $detailed = false;
     }
     $limit = $this->getP("page_size", 10);
     $limit = $this->maxPageSize($limit);
     $page = $this->getP("page", 1);
     $user_filter_prefix = $this->getP("fp", "filter");
     $offset = ($page - 1) * $limit;
     // TODO - should limit search to partner ??
     //		kuserPeer::setUseCriteriaFilter( false );
     //		entryPeer::setUseCriteriaFilter( false );
     $input_params = $this->getInputParams();
     // fill the playlist (infact only the mediaType and contentData are important
     $playlist = new entry();
     $playlist->setType(entryType::PLAYLIST);
     // prepare the playlist type before filling from request
     $obj_wrapper = objectWrapperBase::getWrapperClass($playlist, 0);
     $playlist->setMediaType($this->getP("playlist_mediaType"));
     $data_content = $this->getP("playlist_dataContent");
     $playlist->setDataContent($data_content);
     /*		
     	$updateable_fields = $obj_wrapper->getUpdateableFields() ;
     	$fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields( $input_params , $playlist , "playlist_" , 
     		$updateable_fields , BasePeer::TYPE_PHPNAME ,false );
     */
     // rest is similar to the executeplaylist service
     $extra_filters = array();
     for ($i = 1; $i < self::MAX_FILTER_COUNT; $i++) {
         // filter
         $extra_filter = new entryFilter();
         $fields_set = $extra_filter->fillObjectFromRequest($input_params, "{$user_filter_prefix}{$i}_", null);
         $extra_filters[$i] = $extra_filter;
     }
     $entry_list = myPlaylistUtils::executePlaylist($partner_id, $playlist, $extra_filters, $detailed);
     myEntryUtils::updatePuserIdsForEntries($entry_list);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $wrapper = objectWrapperBase::getWrapperClass($entry_list, $level);
     $this->addMsg("count", count($entry_list));
     $this->addMsg($this->getObjectPrefix(), $wrapper);
 }
Example #26
0
 public function copy($deepCopy = false)
 {
     $copyObj = parent::copy($deepCopy);
     $copyObj->setExternalSourceType($this->getExternalSourceType());
     $refId = $this->getReferenceID();
     if ($refId) {
         $copyObj->setReferenceID($refId);
     }
     return $copyObj;
 }
Example #27
0
 /**
  * @param entry $entry
  * @param FileSyncKey $key
  */
 protected function export(entry $entry, StorageProfile $externalStorage, FileSyncKey $key, $force = false)
 {
     if (!$this->shouldExport($key, $externalStorage)) {
         KalturaLog::log(__METHOD__ . " no need to export key [{$key}] to externalStorage id[" . $externalStorage->getId() . "]");
         return;
     }
     $fileSync = kFileSyncUtils::createPendingExternalSyncFileForKey($key, $externalStorage);
     $srcFileSyncLocalPath = kFileSyncUtils::getLocalFilePathForKey($key, true);
     kJobsManager::addStorageExportJob(null, $entry->getId(), $entry->getPartnerId(), $externalStorage, $fileSync, $srcFileSyncLocalPath, $force);
 }
 private function getAccessControlScope()
 {
     $accessControlScope = accessControlScope::partialInit();
     if ($this->_referrer) {
         $accessControlScope->setReferrer($this->_referrer);
     }
     $accessControlScope->setKs($this->_ks);
     $accessControlScope->setEntryId($this->_entry->getId());
     return $accessControlScope;
 }
Example #29
0
 /**
  * @param asset $asset
  * @params entry $entry
  * @return string
  */
 public static function getFileName(entry $entry, flavorAsset $flavorAsset = null)
 {
     $fileExt = "";
     $fileBaseName = $entry->getName();
     if ($flavorAsset) {
         $flavorParams = $flavorAsset->getFlavorParams();
         if ($flavorParams) {
             $fileBaseName = $fileBaseName . " (" . $flavorParams->getName() . ")";
         }
         $fileExt = $flavorAsset->getFileExt();
     } else {
         $syncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
         if ($fileSync) {
             $fileExt = $fileSync->getFileExt();
         }
     }
     return array($fileBaseName, $fileExt);
 }
Example #30
0
 protected function attachRemoteAssetResource(entry $entry, kDistributionSubmitJobData $data)
 {
     $distributionProfile = DistributionProfilePeer::retrieveByPK($data->getDistributionProfileId());
     /* @var $distributionProfile UnicornDistributionProfile */
     $domainGuid = $distributionProfile->getDomainGuid();
     $applicationGuid = $distributionProfile->getAdFreeApplicationGuid();
     $assetParamsId = $distributionProfile->getRemoteAssetParamsId();
     $mediaItemGuid = $data->getRemoteId();
     $url = "{$domainGuid}/{$applicationGuid}/{$mediaItemGuid}/content.m3u8";
     $entry->setSource(KalturaSourceType::URL);
     $entry->save();
     $isNewAsset = false;
     $asset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $assetParamsId);
     if (!$asset) {
         $isNewAsset = true;
         $assetParams = assetParamsPeer::retrieveByPK($assetParamsId);
         $asset = assetPeer::getNewAsset($assetParams->getType());
         $asset->setPartnerId($entry->getPartnerId());
         $asset->setEntryId($entry->getId());
         $asset->setStatus(asset::FLAVOR_ASSET_STATUS_QUEUED);
         $asset->setFlavorParamsId($assetParamsId);
         $asset->setFromAssetParams($assetParams);
         if ($assetParams->hasTag(assetParams::TAG_SOURCE)) {
             $asset->setIsOriginal(true);
         }
     }
     $asset->incrementVersion();
     $asset->setFileExt('m3u8');
     $asset->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
     $asset->save();
     $syncKey = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $storageProfile = StorageProfilePeer::retrieveByPK($distributionProfile->getStorageProfileId());
     $fileSync = kFileSyncUtils::createReadyExternalSyncFileForKey($syncKey, $url, $storageProfile);
     if ($isNewAsset) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($asset));
     }
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($asset));
     kBusinessPostConvertDL::handleConvertFinished(null, $asset);
 }