コード例 #1
0
ファイル: LiveEntry.php プロジェクト: DBezemer/server
 public function getLocalThumbFilePath($version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $density = 0, $stripProfiles = false, $flavorId = null, $fileName = null)
 {
     if ($this->getStatus() == entryStatus::DELETED || $this->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK) {
         KalturaLog::log("rejected live stream entry - not serving thumbnail");
         KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
     }
     $contentPath = myContentStorage::getFSContentRootPath();
     $liveEntryExist = false;
     $liveThumbEntry = null;
     $liveThumbEntryId = null;
     $partner = $this->getPartner();
     if ($partner) {
         $liveThumbEntryId = $partner->getLiveThumbEntryId();
     }
     if ($liveThumbEntryId) {
         $liveThumbEntry = entryPeer::retrieveByPK($liveThumbEntryId);
     }
     if ($liveThumbEntry && $liveThumbEntry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
         $fileSyncVersion = $partner->getLiveThumbEntryVersion();
         $liveEntryKey = $liveThumbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $fileSyncVersion);
         $contentPath = kFileSyncUtils::getLocalFilePathForKey($liveEntryKey);
         if ($contentPath) {
             $msgPath = $contentPath;
             $liveEntryExist = true;
         } else {
             KalturaLog::err('no local file sync for audio entry id');
         }
     }
     if (!$liveEntryExist) {
         $msgPath = $contentPath . "content/templates/entry/thumbnail/live_thumb.jpg";
     }
     return myEntryUtils::resizeEntryImage($this, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $msgPath, $density, $stripProfiles);
 }
コード例 #2
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     $time_offset = $this->getPM("time_offset");
     $entry_ids = $this->getPM("entry_ids");
     $detailed = $this->getP("detailed", false);
     $separator = $this->getP("separator", ",");
     $id_arr = explode($separator, $entry_ids);
     $limit = 50;
     $id_arr = array_splice($id_arr, 0, $limit);
     $entries = entryPeer::retrieveByPKs($id_arr);
     $updated_entries = array();
     if (!$entries) {
         $this->addError(APIErrors::INVALID_ENTRY_IDS, $entry_ids);
     } else {
         foreach ($entries as $entry) {
             if (!myEntryUtils::createThumbnailFromEntry($entry, $entry, $time_offset)) {
                 $this->addError(APIErrors::INVALID_ENTRY_TYPE, "ENTRY_TYPE_MEDIACLIP [" . $entry->getId() . "]");
                 continue;
             }
             $updated_entries[] = $entry;
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $entry);
             $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
             $wrapper->removeFromCache("entry", $entry->getId());
         }
     }
     $this->addMsg("entries", objectWrapperBase::getWrapperClass($updated_entries, objectWrapperBase::DETAIL_LEVEL_REGULAR));
 }
コード例 #3
0
ファイル: MixingService.php プロジェクト: richhl/kalturaCE
 /**
  * Adds a new mix.
  * If the dataContent is null, a default timeline will be created.
  * 
  * @action add
  * @param KalturaMixEntry $mixEntry Mix entry metadata
  * @return KalturaMixEntry The new mix entry
  */
 function addAction(KalturaMixEntry $mixEntry)
 {
     $mixEntry->validatePropertyMinLength("name", 1);
     $mixEntry->validatePropertyNotNull("editorType");
     $dbEntry = $mixEntry->toObject(new entry());
     $this->checkAndSetValidUser($mixEntry, $dbEntry);
     $this->checkAdminOnlyInsertProperties($mixEntry);
     $this->validateAccessControlId($mixEntry);
     $this->validateEntryScheduleDates($mixEntry);
     $kshow = $this->createDummyKShow();
     $dbEntry->setKshowId($kshow->getId());
     $dbEntry->setPartnerId($this->getPartnerId());
     $dbEntry->setSubpId($this->getPartnerId() * 100);
     $dbEntry->setStatus(KalturaEntryStatus::READY);
     $dbEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_SHOW);
     // for backward compatibility
     if (!$dbEntry->getThumbnail()) {
         $dbEntry->setThumbnail("&auto_edit.jpg");
     }
     $dbEntry->save();
     // we need the id for setDataContent
     // set default data if no data given
     if ($mixEntry->dataContent === null) {
         myEntryUtils::modifyEntryMetadataWithText($dbEntry, "", 0);
     } else {
         $dbEntry->setDataContent($mixEntry->dataContent, true, true);
         $dbEntry->save();
     }
     $kshow->setShowEntry($dbEntry);
     $kshow->save();
     $mixEntry->fromObject($dbEntry);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     return $mixEntry;
 }
コード例 #4
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser, $create_cachekey = false)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("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 );
     $playlist_id = $this->getPM("playlist_id");
     $input_params = $this->getInputParams();
     $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);
         if ($fields_set) {
             $extra_filters[$i] = $extra_filter;
         }
     }
     // this service is executed twice! (first time for the cache key, second time for the execution)
     if (is_null($this->playlist)) {
         $playlist = entryPeer::retrieveByPK($playlist_id);
         if (!$playlist) {
             throw new APIException(APIErrors::INVALID_ENTRY_ID, "Playlist", $playlist_id);
         }
         myPartnerUtils::addPartnerToCriteria(new accessControlPeer(), $playlist->getPartnerId(), $this->getPrivatePartnerData(), $this->partnerGroup2(), null);
         $this->playlist = $playlist;
     }
     if ($create_cachekey) {
         if ($this->isAdmin()) {
             return null;
         }
         $cache_key_arr = array("playlist_id" => $playlist_id, "filters" => $extra_filters);
         $cahce_key = new executionCacheKey();
         $cahce_key->expiry = 600;
         $cahce_key->key = md5(print_r($cache_key_arr, true));
         return $cahce_key;
     }
     if ($this->isAdmin()) {
         myPlaylistUtils::setIsAdminKs(true);
     }
     $entry_list = myPlaylistUtils::executePlaylistById($partner_id, $playlist_id, $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);
 }
コード例 #5
0
ファイル: BaseEntryService.php プロジェクト: richhl/kalturaCE
 /**
  * Generic add entry using an uploaded file, should be used when the uploaded entry type is not known
  *
  * @action addFromUploadedFile
  * @param KalturaBaseEntry $entry
  * @param string $uploadTokenId
  * @param KalturaEntryType $type
  * @return KalturaBaseEntry
  */
 function addFromUploadedFileAction(KalturaBaseEntry $entry, $uploadTokenId, $type = -1)
 {
     try {
         // check that the uploaded file exists
         $entryFullPath = kUploadTokenMgr::getFullPathByUploadTokenId($uploadTokenId);
     } catch (kCoreException $ex) {
         if ($ex->getCode() == kUploadTokenException::UPLOAD_TOKEN_INVALID_STATUS) {
         }
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY);
         throw $ex;
     }
     if (!file_exists($entryFullPath)) {
         $remoteDCHost = kUploadTokenMgr::getRemoteHostForUploadToken($uploadTokenId, kDataCenterMgr::getCurrentDcId());
         if ($remoteDCHost) {
             kFile::dumpApiRequest($remoteDCHost);
         } else {
             throw new KalturaAPIException(KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN);
         }
     }
     // validate the input object
     //$entry->validatePropertyMinLength("name", 1);
     if (!$entry->name) {
         $entry->name = $this->getPartnerId() . '_' . time();
     }
     // first copy all the properties to the db entry, then we'll check for security stuff
     $dbEntry = $entry->toInsertableObject(new entry());
     $dbEntry->setType($type);
     $dbEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_AUTOMATIC);
     $this->checkAndSetValidUser($entry, $dbEntry);
     $this->checkAdminOnlyInsertProperties($entry);
     $this->validateAccessControlId($entry);
     $this->validateEntryScheduleDates($entry);
     $dbEntry->setPartnerId($this->getPartnerId());
     $dbEntry->setSubpId($this->getPartnerId() * 100);
     $dbEntry->setSourceId($uploadTokenId);
     $dbEntry->setSourceLink($entryFullPath);
     $dbEntry->setDefaultModerationStatus();
     $dbEntry->save();
     $kshow = $this->createDummyKShow();
     $kshowId = $kshow->getId();
     myEntryUtils::setEntryTypeAndMediaTypeFromFile($dbEntry, $entryFullPath);
     // setup the needed params for my insert entry helper
     $paramsArray = array("entry_media_source" => KalturaSourceType::FILE, "entry_media_type" => $dbEntry->getMediaType(), "entry_full_path" => $entryFullPath, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
     $token = $this->getKsUniqueString();
     $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
     $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
     $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
     $dbEntry = $insert_entry_helper->getEntry();
     kUploadTokenMgr::closeUploadTokenById($uploadTokenId);
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     $entry->fromObject($dbEntry);
     return $entry;
 }
 protected function updateEntryThumbnail()
 {
     if ($this->getEntryStatus() != entryStatus::READY || !strlen($this->getThumbnailUrl()) || $this->getThumbnailSaved()) {
         return;
     }
     try {
         $entry = entryPeer::retrieveByPKNoFilter($this->getObjectId());
         myEntryUtils::updateThumbnailFromFile($entry, $this->getThumbnailUrl());
     } catch (Exception $e) {
         KalturaLog::err($e->getMessage());
         return;
     }
     $this->setThumbnailSaved(true);
 }
コード例 #7
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     $entry_id = $this->getPM("entry_id");
     $entry = entryPeer::retrieveByPK($entry_id);
     // TODO - verify the user is allowed to modify the entry
     $source_entry_id = $this->getP("source_entry_id");
     if ($source_entry_id) {
         $source_entry = entryPeer::retrieveByPK($source_entry_id);
         if (!$source_entry) {
             return;
         }
     } else {
         $source_entry = $entry;
     }
     $time_offset = $this->getP("time_offset", -1);
     if (!myEntryUtils::createThumbnailFromEntry($entry, $source_entry, $time_offset)) {
         $this->addError(APIErrors::INVALID_ENTRY_TYPE, "ENTRY_TYPE_MEDIACLIP");
         return;
     }
     if ($entry->getType() == entryType::MIX) {
         /*			
         		$roughcutPath = myContentStorage::getFSContentRootPath() . $entry->getDataPath(); // replaced__getDataPath
         		$xml_doc = new DOMDocument();
         		$xml_doc->load( $roughcutPath );
         	
         		if (myMetadataUtils::updateThumbUrl($xml_doc, $entry->getThumbnailUrl()))
         			$xml_doc->save($roughcutPath);
         */
         $sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         $xml_doc = new DOMDocument();
         $xml_doc->loadXML(kFileSyncUtils::file_get_contents($sync_key));
         if (myMetadataUtils::updateThumbUrl($xml_doc, $entry->getThumbnailUrl())) {
             $entry->setMetadata(null, $xml_doc->saveXML(), true, null, null);
             //$entry->getVersion() );
         }
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $entry);
     }
     $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
     $wrapper->removeFromCache("entry", $entry->getId());
     $this->addMsg("entry", $wrapper);
 }
コード例 #8
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser, $create_cachekey = false)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("detailed", false);
     if (!$detailed) {
         $detailed = false;
     }
     $playlist_id = $this->getPM("playlist_id");
     if ($create_cachekey) {
         if ($this->isAdmin()) {
             return null;
         }
         $ks_partner_id = null;
         $privileges = null;
         $ks = ks::fromSecureString(kCurrentContext::$ks);
         if ($ks) {
             $ks_partner_id = $ks->getPartnerId();
             $privileges = $ks->getPrivileges();
         }
         $cache_key_arr = array("playlist_id" => $playlist_id, "partner_id" => $partner_id, "ks_partner_id" => $ks_partner_id, "detailed" => $detailed, "user" => kCurrentContext::$ks_uid, "privileges" => $privileges, "is_admin" => $this->isAdmin(), "protocol" => infraRequestUtils::getProtocol());
         $cahce_key = new executionCacheKey();
         $cahce_key->expiry = 600;
         $cahce_key->key = md5(print_r($cache_key_arr, true));
         return $cahce_key;
     }
     // this service is executed twice! (first time for the cache key, second time for the execution)
     if (is_null($this->playlist)) {
         $playlist = entryPeer::retrieveByPK($playlist_id);
         if (!$playlist) {
             throw new APIException(APIErrors::INVALID_ENTRY_ID, "Playlist", $playlist_id);
         }
         myPartnerUtils::addPartnerToCriteria('accessControl', $playlist->getPartnerId(), $this->getPrivatePartnerData(), $this->partnerGroup2(), null);
         $this->playlist = $playlist;
     }
     if ($this->isAdmin()) {
         myPlaylistUtils::setIsAdminKs(true);
     }
     $entry_list = myPlaylistUtils::executePlaylistById($partner_id, $playlist_id, null, $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);
 }
コード例 #9
0
ファイル: validateFileSyncs.php プロジェクト: DBezemer/server
function deleteObject(FileSync $fileSync)
{
    $object = kFileSyncUtils::retrieveObjectForFileSync($fileSync);
    $key = $object->getSyncKey($fileSync->getObjectSubType());
    if ($key->version != $fileSync->getVersion()) {
        return;
    }
    switch ($fileSync->getObjectType()) {
        case FileSyncObjectType::UICONF:
            $object->setStatus(uiConf::UI_CONF_STATUS_DELETED);
            $object->save();
            break;
        case FileSyncObjectType::ENTRY:
            myEntryUtils::deleteEntry($object);
            try {
                $wrapper = objectWrapperBase::getWrapperClass($object);
                $wrapper->removeFromCache("entry", $object->getId());
            } catch (Exception $e) {
                KalturaLog::err($e);
            }
            break;
        case FileSyncObjectType::ASSET:
            $object->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
            $object->setDeletedAt(time());
            $object->save();
            break;
        case FileSyncObjectType::METADATA:
            $object->setStatus(Metadata::STATUS_DELETED);
            $object->save();
            break;
        default:
            return;
    }
    if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_LINK) {
        return;
    }
    $criteria = new Criteria();
    $criteria->add(FileSyncPeer::DC, $fileSync->getDc());
    $criteria->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_LINK);
    $criteria->add(FileSyncPeer::LINKED_ID, $fileSync->getId());
    $links = FileSyncPeer::doSelect($criteria);
    foreach ($links as $link) {
        deleteObject($link);
    }
}
 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);
 }
コード例 #11
0
 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;
     }
     // 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);
     $entry_list = myPlaylistUtils::executePlaylist($partner_id, $playlist, null, $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);
 }
コード例 #12
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $prefix = $this->getObjectPrefix();
     $entry_id_to_delete = $this->getPM("{$prefix}_id");
     $kshow_id_for_entry_id_to_delete = $this->getP("kshow_id");
     $c = $this->getCriteria();
     if ($c == null) {
         $entry_to_delete = entryPeer::retrieveByPK($entry_id_to_delete);
     } else {
         $entry_to_delete = entryPeer::doSelectOne($c);
     }
     if (!$entry_to_delete) {
         $this->addError(APIErrors::INVALID_ENTRY_ID, $prefix, $entry_id_to_delete);
         return;
     }
     if ($kshow_id_for_entry_id_to_delete != null) {
         // match the kshow_id
         if ($kshow_id_for_entry_id_to_delete != $entry_to_delete->getKshowId()) {
             $this->addError(APIErrors::CANNOT_DELETE_ENTRY, $entry_id_to_delete, $kshow_id_for_entry_id_to_delete);
             return;
         }
     }
     myEntryUtils::deleteEntry($entry_to_delete);
     /*
     	All move into myEntryUtils::deleteEntry
     
     	$entry_to_delete->setStatus ( entryStatus::DELETED );
     	
     	// make sure the moderation_status is set to moderation::MODERATION_STATUS_DELETE
     	$entry_to_delete->setModerationStatus ( moderation::MODERATION_STATUS_DELETE ); 
     	$entry_to_delete->setModifiedAt( time() ) ;
     	$entry_to_delete->save();
     	
     	myNotificationMgr::createNotification( kNotificationJobData::NOTIFICATION_TYPE_ENTRY_DELETE , $entry_to_delete );
     */
     $this->addMsg("deleted_" . $prefix, objectWrapperBase::getWrapperClass($entry_to_delete, objectWrapperBase::DETAIL_LEVEL_REGULAR));
 }
 /**
  * Will forward to the regular swf player according to the widget_id 
  */
 public function execute()
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
     requestUtils::handleConditionalGet();
     ignore_user_abort();
     $entry_id = $this->getRequestParameter("entry_id");
     $widget_id = $this->getRequestParameter("widget_id", 0);
     $upload_token_id = $this->getRequestParameter("upload_token_id");
     $version = $this->getIntRequestParameter("version", null, 0, 10000000);
     $type = $this->getIntRequestParameter("type", 1, 1, 5);
     //Hack: if KMS sends thumbnail request containing "!" char, the type should be treated as 5.
     $width = $this->getRequestParameter("width", -1);
     $height = $this->getRequestParameter("height", -1);
     if (strpos($width, "!") || strpos($height, "!")) {
         $type = 5;
     }
     $width = $this->getFloatRequestParameter("width", -1, -1, 10000);
     $height = $this->getFloatRequestParameter("height", -1, -1, 10000);
     $crop_provider = $this->getRequestParameter("crop_provider", null);
     $quality = $this->getIntRequestParameter("quality", 0, 0, 100);
     $src_x = $this->getFloatRequestParameter("src_x", 0, 0, 10000);
     $src_y = $this->getFloatRequestParameter("src_y", 0, 0, 10000);
     $src_w = $this->getFloatRequestParameter("src_w", 0, 0, 10000);
     $src_h = $this->getFloatRequestParameter("src_h", 0, 0, 10000);
     $vid_sec = $this->getFloatRequestParameter("vid_sec", -1, -1);
     $vid_slice = $this->getRequestParameter("vid_slice", -1);
     $vid_slices = $this->getRequestParameter("vid_slices", -1);
     $density = $this->getFloatRequestParameter("density", 0, 0);
     $stripProfiles = $this->getRequestParameter("strip", null);
     $flavor_id = $this->getRequestParameter("flavor_id", null);
     $file_name = $this->getRequestParameter("file_name", null);
     $file_name = basename($file_name);
     // actual width and height of image from which the src_* values were taken.
     // these will be used to multiply the src_* parameters to make them relate to the original image size.
     $rel_width = $this->getFloatRequestParameter("rel_width", -1, -1, 10000);
     $rel_height = $this->getFloatRequestParameter("rel_height", -1, -1, 10000);
     if ($width == -1 && $height == -1) {
         $width = 120;
         $height = 90;
     } else {
         if ($width == -1) {
             // if only either width or height is missing reset them to zero, and convertImage will handle them
             $width = 0;
         } else {
             if ($height == -1) {
                 $height = 0;
             }
         }
     }
     $bgcolor = $this->getRequestParameter("bgcolor", "ffffff");
     $partner = null;
     // validating the inputs
     if (!is_numeric($quality) || $quality < 0 || $quality > 100) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'quality must be between 20 and 100');
     }
     if (!is_numeric($src_x) || $src_x < 0 || $src_x > 10000) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'src_x must be between 0 and 10000');
     }
     if (!is_numeric($src_y) || $src_y < 0 || $src_y > 10000) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'src_y must be between 0 and 10000');
     }
     if (!is_numeric($src_w) || $src_w < 0 || $src_w > 10000) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'src_w must be between 0 and 10000');
     }
     if (!is_numeric($src_h) || $src_h < 0 || $src_h > 10000) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'src_h must be between 0 and 10000');
     }
     if (!is_numeric($width) || $width < 0 || $width > 10000) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'width must be between 0 and 10000');
     }
     if (!is_numeric($height) || $height < 0 || $height > 10000) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'height must be between 0 and 10000');
     }
     if (!is_numeric($density) || $density < 0) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'density must be positive');
     }
     if (!is_numeric($vid_sec) || $vid_sec < -1) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'vid_sec must be positive');
     }
     if (!preg_match('/^[0-9a-fA-F]{1,6}$/', $bgcolor)) {
         KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'bgcolor must be six hexadecimal characters');
     }
     if ($upload_token_id) {
         $upload_token = UploadTokenPeer::retrieveByPK($upload_token_id);
         if ($upload_token) {
             $partnerId = $upload_token->getPartnerId();
             $partner = PartnerPeer::retrieveByPK($partnerId);
             if ($density == 0) {
                 $density = $partner->getDefThumbDensity();
             }
             if (is_null($stripProfiles)) {
                 $stripProfiles = $partner->getStripThumbProfile();
             }
             $thumb_full_path = myContentStorage::getFSCacheRootPath() . myContentStorage::getGeneralEntityPath("uploadtokenthumb", $upload_token->getIntId(), $upload_token->getId(), $upload_token->getId() . ".jpg");
             kFile::fullMkdir($thumb_full_path);
             if (file_exists($upload_token->getUploadTempPath())) {
                 $src_full_path = $upload_token->getUploadTempPath();
                 $valid_image_types = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP);
                 $image_type = exif_imagetype($src_full_path);
                 if (!in_array($image_type, $valid_image_types)) {
                     // capture full frame
                     myFileConverter::captureFrame($src_full_path, $thumb_full_path, 1, "image2", -1, -1, 3);
                     if (!file_exists($thumb_full_path)) {
                         myFileConverter::captureFrame($src_full_path, $thumb_full_path, 1, "image2", -1, -1, 0);
                     }
                     $src_full_path = $thumb_full_path;
                 }
                 // and resize it
                 myFileConverter::convertImage($src_full_path, $thumb_full_path, $width, $height, $type, $bgcolor, true, $quality, $src_x, $src_y, $src_w, $src_h, $density, $stripProfiles);
                 kFile::dumpFile($thumb_full_path);
             } else {
                 KalturaLog::debug("token_id [{$upload_token_id}] not found in DC [" . kDataCenterMgr::getCurrentDcId() . "]. dump url to romote DC");
                 $remoteUrl = kDataCenterMgr::getRemoteDcExternalUrlByDcId(1 - kDataCenterMgr::getCurrentDcId()) . $_SERVER['REQUEST_URI'];
                 kFile::dumpUrl($remoteUrl);
             }
         }
     }
     if ($entry_id) {
         $entry = entryPeer::retrieveByPKNoFilter($entry_id);
         if (!$entry) {
             // problem could be due to replication lag
             kFile::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrlByDcId(1 - kDataCenterMgr::getCurrentDcId()));
         }
     } else {
         // get the widget
         $widget = widgetPeer::retrieveByPK($widget_id);
         if (!$widget) {
             KExternalErrors::dieError(KExternalErrors::ENTRY_AND_WIDGET_NOT_FOUND);
         }
         // get the kshow
         $kshow_id = $widget->getKshowId();
         $kshow = kshowPeer::retrieveByPK($kshow_id);
         if ($kshow) {
             $entry_id = $kshow->getShowEntryId();
         } else {
             $entry_id = $widget->getEntryId();
         }
         $entry = entryPeer::retrieveByPKNoFilter($entry_id);
         if (!$entry) {
             KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
         }
     }
     $partner = $entry->getPartner();
     if ($density == 0) {
         $density = $partner->getDefThumbDensity();
     }
     $thumbParams = new kThumbnailParameters();
     $thumbParams->setSupportAnimatedThumbnail($partner->getSupportAnimatedThumbnails());
     if (is_null($stripProfiles)) {
         $stripProfiles = $partner->getStripThumbProfile();
     }
     //checks whether the thumbnail display should be restricted by KS
     $base64Referrer = $this->getRequestParameter("referrer");
     $referrer = base64_decode($base64Referrer);
     if (!is_string($referrer)) {
         $referrer = "";
     }
     // base64_decode can return binary data
     if (!$referrer) {
         $referrer = kApiCache::getHttpReferrer();
     }
     $ksStr = $this->getRequestParameter("ks");
     $securyEntryHelper = new KSecureEntryHelper($entry, $ksStr, $referrer, accessControlContextType::THUMBNAIL);
     $securyEntryHelper->validateForPlay();
     // multiply the passed $src_* values so that they will relate to the original image size, according to $src_display_*
     if ($rel_width != -1) {
         $widthRatio = $entry->getWidth() / $rel_width;
         $src_x = $src_x * $widthRatio;
         $src_w = $src_w * $widthRatio;
     }
     if ($rel_height != -1) {
         $heightRatio = $entry->getHeight() / $rel_height;
         $src_y = $src_y * $heightRatio;
         $src_h = $src_h * $heightRatio;
     }
     $subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB;
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
         $subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA;
     }
     KalturaLog::debug("get thumbnail filesyncs");
     $dataKey = $entry->getSyncKey($subType);
     list($file_sync, $local) = kFileSyncUtils::getReadyFileSyncForKey($dataKey, true, false);
     $tempThumbPath = null;
     $entry_status = $entry->getStatus();
     // both 640x480 and 0x0 requests are probably coming from the kdp
     // 640x480 - old kdp version requesting thumbnail
     // 0x0 - new kdp version requesting the thumbnail of an unready entry
     // we need to distinguish between calls from the kdp and calls from a browser: <img src=...>
     // that can't handle swf input
     if (($width == 640 && $height == 480 || $width == 0 && $height == 0) && ($entry_status == entryStatus::PRECONVERT || $entry_status == entryStatus::IMPORT || $entry_status == entryStatus::ERROR_CONVERTING || $entry_status == entryStatus::DELETED)) {
         $contentPath = myContentStorage::getFSContentRootPath();
         $msgPath = $contentPath . "content/templates/entry/bigthumbnail/";
         if ($entry_status == entryStatus::DELETED) {
             $msgPath .= $entry->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK ? "entry_blocked.swf" : "entry_deleted.swf";
         } else {
             $msgPath .= $entry_status == entryStatus::ERROR_CONVERTING ? "entry_error.swf" : "entry_converting.swf";
         }
         kFile::dumpFile($msgPath, null, 0);
     }
     if (!$file_sync) {
         $tempThumbPath = $entry->getLocalThumbFilePath($entry, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $density, $stripProfiles, $flavor_id, $file_name);
         if (!$tempThumbPath) {
             KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
         }
     }
     if (!$local && !$tempThumbPath && $file_sync) {
         if (!in_array($file_sync->getDc(), kDataCenterMgr::getDcIds())) {
             $remoteUrl = $file_sync->getExternalUrl($entry->getId());
             header("Location: {$remoteUrl}");
             die;
         }
         $remoteUrl = kDataCenterMgr::getRedirectExternalUrl($file_sync, $_SERVER['REQUEST_URI']);
         kFile::dumpUrl($remoteUrl);
     }
     // if we didnt return a template for the player die and dont return the original deleted thumb
     if ($entry_status == entryStatus::DELETED) {
         KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
     }
     if (!$tempThumbPath) {
         try {
             $tempThumbPath = myEntryUtils::resizeEntryImage($entry, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, null, $density, $stripProfiles, $thumbParams);
         } catch (Exception $ex) {
             if ($ex->getCode() != kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC) {
                 KalturaLog::log("Error - resize image failed");
                 KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
             }
             // get original flavor asset
             $origFlavorAsset = assetPeer::retrieveOriginalByEntryId($entry_id);
             if (!$origFlavorAsset) {
                 KalturaLog::log("Error - no original flavor for entry [{$entry_id}]");
                 KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
             }
             $syncKey = $origFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
             $remoteFileSync = kFileSyncUtils::getOriginFileSyncForKey($syncKey, false);
             if (!$remoteFileSync) {
                 // file does not exist on any DC - die
                 KalturaLog::log("Error - no FileSync for entry [{$entry_id}]");
                 KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
             }
             if ($remoteFileSync->getDc() == kDataCenterMgr::getCurrentDcId()) {
                 KalturaLog::log("ERROR - Trying to redirect to myself - stop here.");
                 KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
             }
             if (!in_array($remoteFileSync->getDc(), kDataCenterMgr::getDcIds())) {
                 KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
             }
             $remoteUrl = kDataCenterMgr::getRedirectExternalUrl($remoteFileSync);
             kFile::dumpUrl($remoteUrl);
         }
     }
     $nocache = strpos($tempThumbPath, "_NOCACHE_") !== false;
     if ($securyEntryHelper->shouldDisableCache() || kApiCache::hasExtraFields() || !$securyEntryHelper->isKsWidget() && $securyEntryHelper->hasRules()) {
         $nocache = true;
     }
     // notify external proxy, so it'll cache this url
     if (!$nocache && requestUtils::getHost() == kConf::get("apphome_url") && file_exists($tempThumbPath)) {
         self::notifyProxy($_SERVER["REQUEST_URI"]);
     }
     // cache result
     if (!$nocache) {
         $requestKey = $_SERVER["REQUEST_URI"];
         $cache = new myCache("thumb", 86400 * 30);
         // 30 days
         $cache->put($requestKey, $tempThumbPath);
     }
     kFile::dumpFile($tempThumbPath, null, $nocache ? 0 : null);
     // TODO - can delete from disk assuming we caneasily recreate it and it will anyway be cached in the CDN
     // however dumpfile dies at the end so we cant just write it here (maybe register a shutdown callback)
 }
 public static function updateThumbnail($kshow, entry $entry, $should_force = false)
 {
     // We don't want to copy thumbnails of entries that are not ready - they are bad and will later be replaced anyway
     if ($entry->getThumbnail() != null && $entry->isReady()) {
         $show_entry = $kshow->getShowEntry();
         return myEntryUtils::createThumbnail($show_entry, $entry, $should_force);
     }
     return false;
 }
コード例 #15
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $kshows_from_db = null;
     // works in one of 2 ways:
     // 1. get no requested name - will create a new kshow and return its details
     // 2. get some name - tries to fetch by name. if already exists - return it
     // get the new properties for the kuser from the request
     $kshow = new kshow();
     $allow_duplicate_names = $this->getP("allow_duplicate_names", true, true);
     if ($allow_duplicate_names === "false" || $allow_duplicate_names === 0) {
         $allow_duplicate_names = false;
     }
     $return_metadata = $this->getP("metadata", false);
     $detailed = $this->getP("detailed", false);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $obj_wrapper = objectWrapperBase::getWrapperClass($kshow, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kshow, "kshow_", $obj_wrapper->getUpdateableFields());
     // check that mandatory fields were set
     // TODO
     $kshow->setName(trim($kshow->getName()));
     // ASSUME - the name is UNIQUE per partner_id !
     if ($kshow->getName()) {
         if (myPartnerUtils::shouldForceUniqueKshow($partner_id, $allow_duplicate_names)) {
             // in this case willsearch for an existing kshow with this name and return with an error if found
             $kshows_from_db = kshowPeer::getKshowsByName(trim($kshow->getName()));
             if ($kshows_from_db) {
                 $kshow_from_db = $kshows_from_db[0];
                 $this->addDebug("already_exists_objects", count($kshows_from_db));
                 $this->addError(APIErrors::DUPLICATE_KSHOW_BY_NAME, $kshow->getName());
                 // This field in unique. Please change ");
                 if (myPartnerUtils::returnDuplicateKshow($partner_id)) {
                     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, $level));
                 }
                 return;
             }
         }
     }
     // the first kuser to create this kshow will be it's producer
     $producer_id = $puser_kuser->getKuserId();
     $kshow->setProducerId($producer_id);
     // moved to the update - where there is
     $kshow->setPartnerId($partner_id);
     $kshow->setSubpId($subp_id);
     $kshow->setViewPermissions(kshow::KSHOW_PERMISSION_EVERYONE);
     // by default the permissions should be public
     if ($kshow->getPermissions() === null) {
         $kshow->setPermissions(myPrivilegesMgr::PERMISSIONS_PUBLIC);
     }
     // have to save the kshow before creating the default entries
     $kshow->save();
     $show_entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $producer_id, "&auto_edit.jpg", $kshow->getName());
     // roughcut
     $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_VIDEO, $producer_id);
     // intro
     /*
     		$sample_text = $kshow->getName();
     		$host = requestUtils::getHost();
     */
     $sample_text = "";
     myEntryUtils::modifyEntryMetadataWithText($show_entry, $sample_text, "");
     // set the roughcut to false so the update iwll override with better data
     $kshow->setHasRoughcut(false);
     $kshow->initFromTemplate($producer_id, $sample_text);
     $kshow->save();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_ADD, $kshow);
     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow, $level));
     if ($return_metadata) {
         $this->addMsg("metadata", $kshow->getMetadata());
     }
     $this->addDebug("added_fields", $fields_modified);
     if ($kshows_from_db) {
         $this->addDebug("already_exists_objects", count($kshows_from_db));
     }
 }
 private function updateConvertedEntry($ok, $entry, kConversionResult $conv_res)
 {
     $file_before_conversion = $conv_res->conv_cmd->source_file;
     $file_after_conversion = $conv_res->conv_cmd->target_file;
     // TODO -get all targets
     if ($ok == true) {
         // TODO - write all targets not only primary one
         KalturaLog::debug("File [{$file_before_conversion}] converted OK to [{$file_after_conversion}]");
         try {
             // TODO - do we need to create the helpers eagerly ??
             //				$this->createFlvWrappersForTargets( $conv_res );
         } catch (Exception $ex) {
             KalturaLog::debug("Error while creating helper files for [{$file_after_conversion}]");
         }
         $entry->setStatusReady();
     } else {
         KalturaLog::debug("Problem converting file [{$file_before_conversion}]");
         $entry->setStatus(entryStatus::ERROR_CONVERTING);
     }
     $this->updateConversionInDb($entry, $conv_res);
     // loop until the file is really ready - sometimes the size of the file or the mtime is wrong
     for ($i = 0; $i < 15; $i++) {
         clearstatcache();
         if (!file_exists($file_after_conversion) || filesize($file_after_conversion) == 0) {
             //				KalturaLog::debug ( "Entry id [" . $entry->getId() . "] printing file stats: " . print_r( stat ($file_after_conversion ) , true ) );
             KalturaLog::debug("Entry id [" . $entry->getId() . "]. no such file [{$file_after_conversion}]. Sleeping for 1 second for the [{$i}] time.");
             sleep(2);
         } else {
             break;
         }
     }
     KalturaLog::debug("Entry id [" . $entry->getId() . "] setting duration");
     $entry->setLengthInMsecs(kConversionHelper::getFlvDuration($file_after_conversion));
     KalturaLog::debug("Entry id [" . $entry->getId() . "] duration [" . $entry->getLengthInMsecs() . "]");
     // how could it be otherwise ??
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO) {
         // TODO - move out of this function if the partner is required for more configurations
         $partner = PartnerPeer::retrieveByPK($entry->getPartnerId());
         // TODO - make sure the width & height of the target are part of the kConversionReulst
         //			if ( $conversion_info ) $entry->setDimensions ( $conversion_info->video_width , $conversion_info->video_height );
         $offset = $entry->getBestThumbOffset($partner->getDefThumbOffset());
         KalturaLog::debug("Entry id [" . $entry->getId() . "] Thumb offset: [{$offset}]");
         // first create the thumb for the entry
         myEntryUtils::createThumbnailFromEntry($entry, $entry, $offset);
         // 	then make sure it will propage to the roughcut if needed
         myEntryUtils::createRoughcutThumbnailFromEntry($entry, false);
         $entry->updateVideoDimensions();
         KalturaLog::debug("Entry id [" . $entry->getId() . "] dimensions: [" . $entry->getWidth() . "x" . $entry->getHeight() . "]");
     }
     // send notification - regardless its status
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
     $entry->save();
 }
コード例 #17
0
ファイル: kshow.php プロジェクト: DBezemer/server
 public function initFromTemplate($kuser_id, $sample_text = null)
 {
     if (!$this->getHasRoughcut() && $sample_text != null) {
         $show_entry = $this->getShowEntry();
         if (!$show_entry) {
             // have to save the kshow before creating the default entries
             $show_entry = $this->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $kuser_id, null, $this->getName());
             // roughcut
         }
         if (!$this->getIntroId()) {
             $this->createEntry(entry::ENTRY_MEDIA_TYPE_VIDEO, $kuser_id);
             // intro
         }
         // this text should be placed in the partner-config
         KalturaLog::info("before modifyEntryMetadataWithText:\n{$sample_text}");
         myEntryUtils::modifyEntryMetadataWithText($show_entry, $sample_text, 0, true);
         // override the current entry
         $this->setHasRoughcut(false);
     }
 }
コード例 #18
0
 public static function copyEntriesByType(Partner $fromPartner, Partner $toPartner, $entryType, $dontCopyUsers = false)
 {
     KalturaLog::log("Copying entries from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "] with type [" . $entryType . "]");
     entryPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(entryPeer::PARTNER_ID, $fromPartner->getId());
     $c->addAnd(entryPeer::TYPE, $entryType);
     $c->addAnd(entryPeer::STATUS, entryStatus::READY);
     $c->addDescendingOrderByColumn(entryPeer::CREATED_AT);
     $entries = entryPeer::doSelect($c);
     entryPeer::setUseCriteriaFilter(true);
     foreach ($entries as $entry) {
         myEntryUtils::copyEntry($entry, $toPartner, $dontCopyUsers);
     }
 }
コード例 #19
0
<?php

ini_set("memory_limit", "256M");
define('ROOT_DIR', realpath(dirname(__FILE__) . '/../../'));
require_once ROOT_DIR . '/infra/bootstrap_base.php';
require_once ROOT_DIR . '/infra/KAutoloader.php';
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::setClassMapFilePath('../cache/classMap.cache');
KAutoloader::register();
error_reporting(E_ALL);
KalturaLog::setLogger(new KalturaStdoutLogger());
$dbConf = array('datasources' => array('default' => 'propel', 'propel' => array('adapter' => 'mysql', 'connection' => array('classname' => 'KalturaPDO', 'phptype' => 'mysql', 'database' => 'kaltura', 'hostspec' => '192.168.192.4', 'user' => 'kaltura', 'password' => 'kaltura', 'dsn' => 'mysql:host=192.168.192.4;dbname=kaltura;user=kaltura;password=kaltura;')), 'propel2' => array('adapter' => 'mysql', 'connection' => array('classname' => 'KalturaPDO', 'phptype' => 'mysql', 'database' => 'kaltura', 'hostspec' => '192.168.192.4', 'user' => 'kaltura_read', 'password' => 'kaltura_read', 'dsn' => 'mysql:host=192.168.192.4;dbname=kaltura;user=kaltura_read;password=kaltura_read;')), 'propel3' => array('adapter' => 'mysql', 'connection' => array('classname' => 'KalturaPDO', 'phptype' => 'mysql', 'database' => 'kaltura', 'hostspec' => '192.168.192.4', 'user' => 'kaltura_read', 'password' => 'kaltura_read', 'dsn' => 'mysql:host=192.168.192.4;dbname=kaltura;user=kaltura_read;password=kaltura_read;'))), 'log' => array('ident' => 'kaltura', 'level' => '7'));
//$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$entryIds = array("0_dborm9lg", "0_imoflf6p", "0_3wm9a6t5", "0_cic44kil", "0_t4yew63l", "0_j1w2l0uo", "0_hmfl6yqm", "0_j4ciu5i8", "0_9exkfida", "0_t8i28aed", "0_mfzy6fk8", "0_8iy78nc9", "0_k8ymic7i", "0_kebpfp7z", "0_f4wb8f7o", "0_21hgvyre", "0_yc4frw3n", "0_xcrrzimo", "0_ttu09fn8", "0_nv77ncna", "0_dx18o48f", "0_ssuzmxjb", "0_7o9752ad", "0_pdzuunaa", "0_tymuie23", "0_vt8j64df", "0_dn3be3s1", "0_1naibde2", "0_0215mb05", "0_l1qu67u2", "0_0qpt6fbl", "0_o9xrvyv3", "0_rjlbesk0", "0_0riz850n", "8ix7p4nf6s", "0_3bpvujdf", "0_ddhyy406", "0_jdzti6gj", "g940g7miui", "0_o6m9rxsx", "0_qbujfju1", "s5qjpsjdnq", "s1m3dg09dw", "4tl281rhe8", "0_r6ehikfb", "0_s1ymi20f", "0_c087s9fw", "0_0jxtpm3o", "0_bi1oond7", "0_26xr3ht9", "0_tt5bc5xi", "0_3vxvcx0c", "0_336gw1eq", "0_a7nnunh6", "0_bs3jytlv", "0_r5abi3sz", "0_107z8t15", "0_5y5jlxga", "8z8ejn2c05", "0_ls0qsskt", "scs2tb20nc", "kuag5odijy", "c3o8gn8zoy", "0_pjmp0pk5", "0_qepjemqa", "0_phw09gy2", "0_byhgfhm2", "0_cgdx8az5", "0_jyfskrz1", "0_taz94tkf", "0_tpg7dxfz", "0_jdnikam7", "0_faxgi5zh", "0_8q6agy4v", "0_za7d1dlv", "0_9rq9j3ue", "0_90x6alrf", "0_sgj0jpbp", "0_dzqp2hve", "0_2vo8i3zm", "0_pbj0mewb", "0_ecjqlvcx", "0_qwx5tnnh", "0_csow76ak", "0_ippmvqxb", "0_5haayn3s", "0_scx59ihb", "0_e3c218nb", "0_tsokmp6i", "0_6ffche90", "0_qo5oa2aa", "0_grjmi99x", "0_c43tio3q", "0_wdp2nukp", "0_im7bqzvs", "0_8znu0fzn", "0_r88o5k28", "0_lm0ctgv4", "0_861czc6n", "0_fxybu3tb", "0_dl09yagk", "fgh8g7uc4c", "0_3ruyl4so", "0_uz9wwbi0", "0_i0wm8ylp", "0_gj2hfml9", "0_k5fttrmg", "0_ucqrdlm7", "0_semkx9jy", "0_js9xbszt", "0_oho170pf", "kzawobh3ty", "0_a2ph89tt", "irp1nztkts", "66r541rpjs", "0_lrrvlb7w", "0_0k002875", "0_vx5hb6jn", "0_l4liidjf", "0_g3nzwjdz", "0_uqxgy01f", "0_ugw90c4t", "0_tf1dd91a", "0_30eeu66b", "mov5ips91k", "6ir3dui0d0", "0_opitrvgr", "0_oc5vhd33", "0_plefn9cl", "0_0stl9gvz", "0_vth1aakn", "0_eyqbhsq9", "0_52na77mr", "0_7yi05auv", "0_dh11mjm2", "0_4evhzdbl", "dz727fptf0", "0_xqncw5pv", "0_2rl97bry", "0_x8uxq77g", "0_9784h9p5", "0_hwhdajmr", "0_fuqs22j4", "4la8ruega0", "0_zoq8xc3k", "0_beiaainf", "0_v0agxi9k", "umuobsfqos", "sfmrr36r5c", "0_63sprljk", "0_ktgi5sdv", "0_j5w9grsg", "0_z4rvq5m3", "sns6g8rp40", "0_szhtu39v", "wkwm07e2mw", "0_3mp68oqn", "0_un7q4ujm", "0_k9yu4jt2", "h2a4caf7nk", "fvjac6zlmk", "36ko97bsy4", "0_6pqen4pp", "gmvioznyq0", "gkiq0jsp90", "q6ojro0zhg", "0_fwectuev", "0_n04gvx36", "0_5aot3gzv", "p21ippxs70", "ncrww3l4j4", "q3fucnyueo", "58bjik2zbc", "3ck2qf1rnk", "dk2957a76g", "heo5zst99c", "ri5waxv6hs", "gtthmlm78s", "yzcgjotw0o", "6o4z2tp314", "0_d90mqlli", "qfnu55tt7k", "ybugoe78ai", "6h1pb6f3to", "1k9vxhvpk0", "2lvaw1odvm", "2i8t6vxyuo", "3nkrks76w4", "0_xjdcym4v", "0_ez86zub3", "0_xjnit0g7", "0_njp5gk8s", "dfoymlus6t");
$sizeFile = fopen('size.csv', 'a');
$entries = entryPeer::retrieveByPKs($entryIds);
foreach ($entries as $entry) {
    $size = myEntryUtils::calcStorageSize($entry);
    fputcsv($sizeFile, array($size, $entry->getId()));
}
fclose($sizeFile);
echo 'Done';
コード例 #20
0
 protected function updatedVirusScanFinished(BatchJob $dbBatchJob, kVirusScanJobData $data, BatchJob $twinJob = null)
 {
     $flavorAsset = flavorAssetPeer::retrieveById($data->getFlavorAssetId());
     if (!$flavorAsset) {
         KalturaLog::err('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']');
         throw new Exception('Flavor asset not found with id [' . $data->getFlavorAssetId() . ']');
     }
     switch ($data->getScanResult()) {
         case KalturaVirusScanJobResult::FILE_WAS_CLEANED:
         case KalturaVirusScanJobResult::FILE_IS_CLEAN:
             $this->resumeEvents($flavorAsset);
             break;
         case KalturaVirusScanJobResult::FILE_INFECTED:
             $entry = $flavorAsset->getentry();
             if (!$entry) {
                 KalturaLog::err('Entry not found with id [' . $entry->getId() . ']');
             } else {
                 $entry->setStatus(VirusScanPlugin::getEntryStatusCoreValue(VirusScanEntryStatus::INFECTED));
                 $entry->save();
             }
             // delete flavor asset and entry if defined in virus scan profile
             if ($data->getVirusFoundAction() == KalturaVirusFoundAction::CLEAN_DELETE || $data->getVirusFoundAction() == KalturaVirusFoundAction::DELETE) {
                 $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 $filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                 KalturaLog::debug('FlavorAsset [' . $flavorAsset->getId() . '] marked as deleted');
                 $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
                 $flavorAsset->setDeletedAt(time());
                 $flavorAsset->save();
                 KalturaLog::debug('Physically deleting file [' . $filePath . ']');
                 unlink($filePath);
                 if ($entry) {
                     myEntryUtils::deleteEntry($entry);
                 }
             } else {
                 $flavorAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
                 $flavorAsset->save();
             }
             myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
             // do not resume flavor asset added event consumption
             break;
     }
     return $dbBatchJob;
 }
コード例 #21
0
ファイル: MediaService.php プロジェクト: richhl/kalturaCE
 /**
  * Adds new media entry by importing the media file from a search provider. 
  * This action should be used with the search service result.
  *
  * @action addFromSearchResult
  * @param KalturaMediaEntry $mediaEntry Media entry metadata
  * @param KalturaSearchResult $searchResult Result object from search service
  * @return KalturaMediaEntry The new media entry
  * 
  * @throws KalturaErrors::PROPERTY_VALIDATION_MIN_LENGTH
  * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
  */
 function addFromSearchResultAction(KalturaMediaEntry $mediaEntry = null, KalturaSearchResult $searchResult = null)
 {
     if ($mediaEntry === null) {
         $mediaEntry = new KalturaMediaEntry();
     }
     if ($searchResult === null) {
         $searchResult = new KalturaSearchResult();
     }
     // copy the fields from search result if they are missing in media entry
     // this should be checked before prepareEntry method call
     if ($mediaEntry->name === null) {
         $mediaEntry->name = $searchResult->title;
     }
     if ($mediaEntry->mediaType === null) {
         $mediaEntry->mediaType = $searchResult->mediaType;
     }
     if ($mediaEntry->description === null) {
         $mediaEntry->description = $searchResult->description;
     }
     if ($mediaEntry->creditUrl === null) {
         $mediaEntry->creditUrl = $searchResult->sourceLink;
     }
     if ($mediaEntry->creditUserName === null) {
         $mediaEntry->creditUserName = $searchResult->credit;
     }
     if ($mediaEntry->tags === null) {
         $mediaEntry->tags = $searchResult->tags;
     }
     $searchResult->validatePropertyNotNull("searchSource");
     $mediaEntry->sourceType = KalturaSourceType::SEARCH_PROVIDER;
     $mediaEntry->searchProviderType = $searchResult->searchSource;
     $mediaEntry->searchProviderId = $searchResult->id;
     $dbEntry = $this->prepareEntryForInsert($mediaEntry);
     $dbEntry->setSourceId($searchResult->id);
     $kshowId = $dbEntry->getKshowId();
     // $searchResult->licenseType; // FIXME, No support for licenseType
     // FIXME - no need to clone entry if $dbEntry->getSource() == entry::ENTRY_MEDIA_SOURCE_KALTURA_USER_CLIPS
     if ($dbEntry->getSource() == entry::ENTRY_MEDIA_SOURCE_KALTURA || $dbEntry->getSource() == entry::ENTRY_MEDIA_SOURCE_KALTURA_PARTNER || $dbEntry->getSource() == entry::ENTRY_MEDIA_SOURCE_KALTURA_PARTNER_KSHOW || $dbEntry->getSource() == entry::ENTRY_MEDIA_SOURCE_KALTURA_KSHOW || $dbEntry->getSource() == entry::ENTRY_MEDIA_SOURCE_KALTURA_USER_CLIPS) {
         $sourceEntryId = $searchResult->id;
         $copyDataResult = myEntryUtils::copyData($sourceEntryId, $dbEntry);
         if (!$copyDataResult) {
             // will be false when the entry id was not found
             throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $sourceEntryId);
         }
         $dbEntry->setStatusReady();
         $dbEntry->save();
     } else {
         // setup the needed params for my insert entry helper
         $paramsArray = array("entry_media_source" => $dbEntry->getSource(), "entry_media_type" => $dbEntry->getMediaType(), "entry_url" => $searchResult->url, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
         $token = $this->getKsUniqueString();
         $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
         $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
         $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
         $dbEntry = $insert_entry_helper->getEntry();
     }
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
     $mediaEntry->fromObject($dbEntry);
     return $mediaEntry;
 }
 /**
  * Index an entry by id.
  * 
  * @action index
  * @param string $id
  * @param bool $shouldUpdate
  * @return int entry int id
  */
 function indexAction($id, $shouldUpdate = true)
 {
     if (kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_INDEX_OBJECT_WHEN_ENTITLEMENT_IS_ENABLE);
     }
     $entryDb = entryPeer::retrieveByPK($id);
     if (!$entryDb) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $id);
     }
     if (!$shouldUpdate) {
         $entryDb->indexToSearchIndex();
         return $entryDb->getIntId();
     }
     return myEntryUtils::index($entryDb);
 }
コード例 #23
0
ファイル: PlaylistService.php プロジェクト: wzur/server
 /**
  * Retrieve playlist for playing purpose, based on content
  * @disableTags TAG_WIDGET_SESSION
  *
  * @action executeFromContent
  * @param KalturaPlaylistType $playlistType
  * @param string $playlistContent
  * @param string $detailed
  * @param KalturaFilterPager $pager
  * @return KalturaBaseEntryArray
  */
 function executeFromContentAction($playlistType, $playlistContent, $detailed = false, $pager = null)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
     if ($this->getKs() && is_object($this->getKs()) && $this->getKs()->isAdmin()) {
         myPlaylistUtils::setIsAdminKs(true);
     }
     $entryList = array();
     if ($playlistType == KalturaPlaylistType::DYNAMIC) {
         $entryList = myPlaylistUtils::executeDynamicPlaylist($this->getPartnerId(), $playlistContent, null, true, $pager);
     } else {
         if ($playlistType == KalturaPlaylistType::STATIC_LIST) {
             $entryList = myPlaylistUtils::executeStaticPlaylistFromEntryIdsString($playlistContent, null, true, $pager);
         }
     }
     myEntryUtils::updatePuserIdsForEntries($entryList);
     return KalturaBaseEntryArray::fromDbArray($entryList, $this->getResponseProfile());
 }
コード例 #24
0
 public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
 {
     KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
     $newEntry = $entry->copy();
     $newEntry->setIntId(null);
     if ($toPartner instanceof Partner) {
         $newEntry->setPartnerId($toPartner->getId());
         $newEntry->setSubpId($toPartner->getId() * 100);
         $newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
         $flavorParamsStr = $entry->getFlavorParamsIds();
         $flavorParams = explode(',', $flavorParamsStr);
         $newFlavorParams = array();
         foreach ($flavorParams as $flavorParamsId) {
             $newFlavorParamsId = kObjectCopyHandler::getMappedId('flavorParams', $flavorParamsId);
             if (is_null($newFlavorParamsId)) {
                 $newFlavorParamsId = $flavorParamsId;
             }
             $newFlavorParams[] = $newFlavorParamsId;
         }
         $newEntry->setFlavorParamsIds(implode(',', $newFlavorParams));
     }
     $newKuser = null;
     if (!$dontCopyUsers) {
         // copy the kuser (if the same puser id exists its kuser will be used)
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = $entry->getKuser();
         $newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
         $newEntry->setKuserId($newKuser->getId());
         kuserPeer::setUseCriteriaFilter(true);
     }
     // copy the kshow
     kshowPeer::setUseCriteriaFilter(false);
     $kshow = $entry->getKshow();
     if ($kshow) {
         $newKshow = $kshow->copy();
         $newKshow->setIntId(null);
         $newKshow->setPartnerId($toPartner->getId());
         $newKshow->setSubpId($toPartner->getId() * 100);
         if ($newKuser) {
             $newKshow->setProducerId($newKuser->getId());
         }
         $newKshow->save();
         $newEntry->setKshowId($newKshow->getId());
     }
     kshowPeer::setUseCriteriaFilter(true);
     // reset the statistics
     myEntryUtils::resetEntryStatistics($newEntry);
     // set the new partner id into the default category criteria filter
     $defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
     $oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
     // save the entry
     $newEntry->save();
     // restore the original partner id in the default category criteria filter
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
     KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
     // for any type that does not require assets:
     $shouldCopyDataForNonClip = $entry->getType() != entryType::MEDIA_CLIP;
     $shouldCopyDataForClip = false;
     // only images get their data copied
     if ($entry->getType() == entryType::MEDIA_CLIP) {
         if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
             $shouldCopyDataForClip = true;
         }
     }
     if ($shouldCopyDataForNonClip || $shouldCopyDataForClip) {
         // copy the data
         $from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         // replaced__getDataPath
         $to = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         // replaced__getDataPath
         KalturaLog::log("copyEntriesByType - copying entry data [" . $from . "] to [" . $to . "]");
         kFileSyncUtils::softCopy($from, $to);
     }
     $ismFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
     if (kFileSyncUtils::fileSync_exists($ismFrom)) {
         $ismTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
         KalturaLog::log("copying entry ism [" . $ismFrom . "] to [" . $ismTo . "]");
         kFileSyncUtils::softCopy($ismFrom, $ismTo);
     }
     $ismcFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
     if (kFileSyncUtils::fileSync_exists($ismcFrom)) {
         $ismcTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
         KalturaLog::log("copying entry ism [" . $ismcFrom . "] to [" . $ismcTo . "]");
         kFileSyncUtils::softCopy($ismcFrom, $ismcTo);
     }
     $from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     // replaced__getThumbnailPath
     $considerCopyThumb = true;
     // if entry is image - data is thumbnail, and it was copied
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
         $considerCopyThumb = false;
     }
     // if entry is not clip, and there is no file in both DCs - nothing to copy
     if ($entry->getType() != entryType::MEDIA_CLIP && !kFileSyncUtils::file_exists($from, true)) {
         $considerCopyThumb = false;
     }
     if ($considerCopyThumb) {
         $skipThumb = false;
         // don't attempt to copy a thumbnail for images - it's the same as the data which was just created
         if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_AUDIO) {
             // check if audio entry has real thumb, if not - don't copy thumb.
             $originalFileSync = kFileSyncUtils::getOriginFileSyncForKey($from, false);
             if (!$originalFileSync) {
                 $skipThumb = true;
             }
         }
         if (!$skipThumb) {
             $to = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
             // replaced__getThumbnailPath
             KalturaLog::log("copyEntriesByType - copying entry thumbnail [" . $from . "] to [" . $to . "]");
             kFileSyncUtils::softCopy($from, $to);
         }
     }
     // added by Tan-Tan 12/01/2010 to support falvors copy
     $sourceFlavorAssets = flavorAssetPeer::retrieveByEntryId($entry->getId());
     foreach ($sourceFlavorAssets as $sourceFlavorAsset) {
         $sourceFlavorAsset->copyToEntry($newEntry->getId(), $newEntry->getPartnerId());
     }
 }
コード例 #25
0
ファイル: kBusinessConvertDL.php プロジェクト: dozernz/server
 /**
  * @param entry $entry
  * @param entry $tempEntry
  */
 public static function replaceEntry(entry $entry, entry $tempEntry = null)
 {
     if (!$tempEntry) {
         $tempEntry = entryPeer::retrieveByPK($entry->getReplacingEntryId());
     }
     if (!$tempEntry) {
         KalturaLog::err("Temp entry id [" . $entry->getReplacingEntryId() . "] not found");
         return;
     }
     //Extract all assets of the temp entry
     $tempAssets = assetPeer::retrieveByEntryId($tempEntry->getId());
     //Extract all assets of the existing entry
     $oldAssets = assetPeer::retrieveByEntryId($entry->getId());
     $newAssets = array();
     //Loop which creates a mapping between the new assets' paramsId and their type to the asset itself
     foreach ($tempAssets as $newAsset) {
         if ($newAsset->getStatus() != asset::FLAVOR_ASSET_STATUS_READY) {
             KalturaLog::info("Do not add new asset [" . $newAsset->getId() . "] to flavor [" . $newAsset->getFlavorParamsId() . "] status [" . $newAsset->getStatus() . "]");
             continue;
         }
         //If doesn't exist - create a new array for the current asset's type.
         if (!isset($newAssets[$newAsset->getType()])) {
             $newAssets[$newAsset->getType()] = array();
         }
         if ($newAsset->getFlavorParamsId() || $newAsset instanceof flavorAsset) {
             $newAssets[$newAsset->getType()][$newAsset->getFlavorParamsId()] = $newAsset;
             KalturaLog::info("Added new asset [" . $newAsset->getId() . "] for asset params [" . $newAsset->getFlavorParamsId() . "]");
         } else {
             $newAssets[$newAsset->getType()]['asset_' . count($newAssets[$newAsset->getType()])] = $newAsset;
             KalturaLog::info("Added new asset [" . $newAsset->getId() . "] with no asset params");
         }
     }
     $defaultThumbAssetNew = null;
     $defaultThumbAssetOld = null;
     foreach ($oldAssets as $oldAsset) {
         /* @var $oldAsset asset */
         //If the newAssets map contains an asset of the same type and paramsId as the current old asset,
         // re-link the old asset to the new asset.
         if (isset($newAssets[$oldAsset->getType()]) && isset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()])) {
             $newAsset = $newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()];
             if ($oldAsset->hasTag(assetParams::TAG_RECORDING_ANCHOR)) {
                 $newAsset->addTags(array(assetParams::TAG_RECORDING_ANCHOR));
             }
             /* @var $newAsset asset */
             KalturaLog::info("Create link from new asset [" . $newAsset->getId() . "] to old asset [" . $oldAsset->getId() . "] for flavor [" . $oldAsset->getFlavorParamsId() . "]");
             $oldAsset->linkFromAsset($newAsset);
             $oldAsset->save();
             self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
             self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_ISM);
             self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
             self::createFileSyncLinkFromReplacingAsset($oldAsset, $newAsset, asset::FILE_SYNC_ASSET_SUB_TYPE_MPD);
             $newFlavorMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($newAsset->getId());
             if ($newFlavorMediaInfo) {
                 $oldFlavorNewMediaInfo = $newFlavorMediaInfo->copy();
                 $oldFlavorNewMediaInfo->setFlavorAssetId($oldAsset->getId());
                 $oldFlavorNewMediaInfo->setFlavorAssetVersion($oldAsset->getVersion());
                 $oldFlavorNewMediaInfo->save();
             }
             unset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()]);
             if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
                 $defaultThumbAssetNew = $oldAsset;
                 KalturaLog::info("Nominating ThumbAsset [" . $oldAsset->getId() . "] as the default ThumbAsset after replacent");
             }
         } elseif ($oldAsset instanceof flavorAsset || $oldAsset instanceof thumbAsset) {
             if ($oldAsset instanceof thumbAsset && $oldAsset->keepOnEntryReplacement()) {
                 KalturaLog::info("KeepManualThumbnails ind is set, manual thumbnail is not deleted [" . $oldAsset->getId() . "]");
                 if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
                     $defaultThumbAssetOld = $oldAsset;
                 }
             } else {
                 KalturaLog::info("Delete old asset [" . $oldAsset->getId() . "] for paramsId [" . $oldAsset->getFlavorParamsId() . "]");
                 $oldAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
                 $oldAsset->setDeletedAt(time());
                 $oldAsset->save();
             }
         }
     }
     foreach ($newAssets as $newAssetsByTypes) {
         foreach ($newAssetsByTypes as $newAsset) {
             $createdAsset = $newAsset->copyToEntry($entry->getId(), $entry->getPartnerId());
             KalturaLog::info("Copied from new asset [" . $newAsset->getId() . "] to copied asset [" . $createdAsset->getId() . "] for flavor [" . $newAsset->getFlavorParamsId() . "]");
             if ($createdAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
                 $defaultThumbAssetNew = $newAsset;
                 KalturaLog::info("Nominating ThumbAsset [" . $newAsset->getId() . "] as the default ThumbAsset after replacent");
             }
         }
     }
     if ($defaultThumbAssetOld) {
         KalturaLog::info("Kepping ThumbAsset [" . $defaultThumbAssetOld->getId() . "] as the default ThumbAsset");
     } elseif ($defaultThumbAssetNew) {
         kBusinessConvertDL::setAsDefaultThumbAsset($defaultThumbAssetNew);
         KalturaLog::info("Setting ThumbAsset [" . $defaultThumbAssetNew->getId() . "] as the default ThumbAsset");
     } else {
         KalturaLog::info("No default ThumbAsset found for replacing entry [" . $tempEntry->getId() . "]");
         $entry->setThumbnail(".jpg");
         // thumbnailversion++
         $entry->save();
         $tempEntrySyncKey = $tempEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
         $realEntrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
         kFileSyncUtils::createSyncFileLinkForKey($realEntrySyncKey, $tempEntrySyncKey);
     }
     self::createIsmManifestFileSyncLinkFromReplacingEntry($tempEntry, $entry);
     $entry->setDimensions($tempEntry->getWidth(), $tempEntry->getHeight());
     $entry->setLengthInMsecs($tempEntry->getLengthInMsecs());
     $entry->setConversionProfileId($tempEntry->getConversionProfileId());
     $entry->setConversionQuality($tempEntry->getConversionQuality());
     $entry->setReplacingEntryId(null);
     $entry->setReplacementStatus(entryReplacementStatus::NONE);
     $entry->setReplacementOptions(null);
     $entry->setStatus($tempEntry->getStatus());
     $entry->save();
     //flush deffered events to re-index sphinx before temp entry deletion
     kEventsManager::flushEvents();
     kBusinessConvertDL::checkForPendingLiveClips($entry);
     kEventsManager::raiseEvent(new kObjectReplacedEvent($entry, $tempEntry));
     myEntryUtils::deleteEntry($tempEntry, null, true);
     $te = new TrackEntry();
     $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_REPLACED_ENTRY);
     $te->setEntryId($entry->getId());
     $te->setParam1Str($tempEntry->getId());
     $te->setDescription(__METHOD__ . "[" . __LINE__ . "]");
     TrackEntry::addTrackEntry($te);
 }
コード例 #26
0
 public function execute()
 {
     $this->forceSystemAuthentication();
     $source_kshow_id = $this->getP("source_kshow_id");
     $target_kshow_id = $this->getP("target_kshow_id");
     $kuser_names = $this->getP("kuser_names");
     $reset = $this->getP("reset");
     if ($reset) {
         $source_kshow_id = null;
         $target_kshow_id = null;
         $kuser_names = null;
     }
     $mode = 0;
     // view
     if ($source_kshow_id && $target_kshow_id && $kuser_names) {
         $mode = 1;
         // review
         $list_of_kuser_names = explode(",", $kuser_names);
         foreach ($list_of_kuser_names as &$name) {
             $name = trim($name);
         }
         $source_kshow = kshowPeer::retrieveByPK($source_kshow_id);
         $target_kshow = kshowPeer::retrieveByPK($target_kshow_id);
         $target_partner_id = $target_kshow->getPartnerId();
         $target_subp_id = $target_kshow->getSubpId();
         $c = new Criteria();
         // select only the kusers of the correct partner_id
         $c->add(kuserPeer::SCREEN_NAME, $list_of_kuser_names, Criteria::IN);
         $c->setLimit(10);
         //$c->add ( kuserPeer::PARTNER_ID , $target_partner_id );
         $list_of_kusers = kuserPeer::doSelect($c);
         $producer = kuserPeer::retrieveByPK($target_kshow->getProducerId());
         $list_of_kusers[] = $producer;
         $c->add(kuserPeer::PARTNER_ID, $target_partner_id);
         $list_of_valid_kusers = kuserPeer::doSelect($c);
         $list_of_valid_kusers[] = $producer;
         $c = new Criteria();
         $c->add(entryPeer::KSHOW_ID, $source_kshow_id);
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         $c->add(entryPeer::STATUS, entryStatus::READY);
         $entries = entryPeer::doSelectJoinAll($c);
         $entry_kusers = array();
         // assign each entry to a kuser
         foreach ($entries as $entry) {
             $place_in_array = count($entry_kusers) % count($list_of_valid_kusers);
             $kuser = $list_of_valid_kusers[$place_in_array];
             $entry_kusers[$entry->getId()] = $kuser->getId();
         }
         $clone = $this->getP("clone");
         if ($clone == 'true') {
             $mode = 2;
             // clone
             $entry_id_map = array();
             // will be used to map the source->target entries
             $entry_cache = array();
             // will be used to cache all relevat entries
             $new_entry_list = array();
             $failed_entry_list = array();
             foreach ($entries as $entry) {
                 try {
                     $kuser_id = $entry_kusers[$entry->getId()];
                     $override_fields = $entry->copy();
                     $override_fields->setPartnerId($target_kshow->getPartnerId());
                     $override_fields->setSubpId($target_kshow->getSubpId());
                     $override_fields->setKuserId($kuser_id);
                     $override_fields->setCreatorKuserId($kuser_id);
                     $new_entry = myEntryUtils::deepClone($entry, $target_kshow_id, $override_fields, false);
                     $new_entry_list[] = $new_entry;
                     // will help fix the metadata entries
                     $entry_id_map[$entry->getId()] = $new_entry->getId();
                     $entry_cache[$entry->getId()] = $entry;
                     $entry_cache[$new_entry->getId()] = $new_entry;
                 } catch (Exception $ex) {
                     $failed_entry_list[] = $entry;
                 }
                 //					echo "entry [{$entry->getId()}] copied<br>"; flush();
             }
             // now clone the show_entry
             $new_show_entry = $target_kshow->getShowEntry();
             myEntryUtils::deepCloneShowEntry($source_kshow->getShowEntry(), $new_show_entry, $entry_id_map, $entry_cache);
             $new_entry_list[] = $new_show_entry;
             $entries = $new_entry_list;
             $entry_kusers = null;
         }
         //			echo "ended!<bR>";			flush();
     }
     $this->source_kshow_id = @$source_kshow_id;
     $this->target_kshow_id = @$target_kshow_id;
     $this->partner_id = @$target_partner_id;
     $this->source_kshow = @$source_kshow;
     $this->target_kshow = @$target_kshow;
     $this->kuser_names = @$kuser_names;
     $this->list_of_kusers = @$list_of_kusers;
     $this->entries = @$entries;
     $this->mode = $mode;
     $this->entry_kusers = @$entry_kusers;
     //		echo "going to template!<bR>";		flush();
 }
コード例 #27
0
if ($argc != 2) {
    echo "Arguments missing.\n\n";
    echo "Usage: php removePartnerEntries.php {partner id}\n";
    exit;
}
$partnerId = $argv[1];
set_time_limit(0);
ini_set("memory_limit", "1024M");
define('ROOT_DIR', realpath(dirname(__FILE__) . '/../../'));
require_once ROOT_DIR . '/infra/bootstrap_base.php';
require_once ROOT_DIR . '/infra/KAutoloader.php';
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "metadata", "*"));
KAutoloader::setClassMapFilePath('../cache/classMap.cache');
KAutoloader::register();
error_reporting(E_ALL);
KalturaLog::setLogger(new KalturaStdoutLogger());
$typesToDelete = array(entryType::DATA, entryType::DOCUMENT);
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$c = new Criteria();
$c->add(entryPeer::PARTNER_ID, $partnerId);
$c->add(entryPeer::TYPE, $typesToDelete, Criteria::IN);
$entries = entryPeer::doSelect($c);
foreach ($entries as $entry) {
    KalturaLog::debug("Deletes entry [" . $entry->getId() . "]");
    myEntryUtils::deleteEntry($entry, $partnerId);
}
KalturaLog::debug("Done");
コード例 #28
0
 protected function updateThumbnailForEntryFromSourceEntry($entryId, $sourceEntryId, $timeOffset, $entryType = null, $flavorParamsId = null)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry || $entryType !== null && $dbEntry->getType() != $entryType) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $sourceDbEntry = entryPeer::retrieveByPK($sourceEntryId);
     if (!$sourceDbEntry || $sourceDbEntry->getType() != KalturaEntryType::MEDIA_CLIP) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $sourceDbEntry);
     }
     // if session is not admin, we should check that the user that is updating the thumbnail is the one created the entry
     if (!$this->getKs() || !$this->getKs()->isAdmin()) {
         if (strtolower($dbEntry->getPuserId()) !== strtolower($this->getKs()->user)) {
             throw new KalturaAPIException(KalturaErrors::PERMISSION_DENIED_TO_UPDATE_ENTRY);
         }
     }
     $updateThumbnailResult = myEntryUtils::createThumbnailFromEntry($dbEntry, $sourceDbEntry, $timeOffset, $flavorParamsId);
     if (!$updateThumbnailResult) {
         throw new KalturaAPIException(KalturaErrors::INTERNAL_SERVERL_ERROR);
     }
     try {
         $wrapper = objectWrapperBase::getWrapperClass($dbEntry);
         $wrapper->removeFromCache("entry", $dbEntry->getId());
     } catch (Exception $e) {
         KalturaLog::err($e);
     }
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_THUMBNAIL, $dbEntry, $dbEntry->getPartnerId(), $dbEntry->getPuserId(), null, null, $entryId);
     $ks = $this->getKs();
     $isAdmin = false;
     if ($ks) {
         $isAdmin = $ks->isAdmin();
     }
     $mediaEntry = KalturaEntryFactory::getInstanceByType($dbEntry->getType(), $isAdmin);
     $mediaEntry->fromObject($dbEntry, $this->getResponseProfile());
     return $mediaEntry;
 }
コード例 #29
0
ファイル: entry.php プロジェクト: AdiTal/server
 /**
  * will create thumbnail according to the entry type
  * @return the thumbnail path.
  */
 public function getLocalThumbFilePath($version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $density = 0, $stripProfiles = false, $flavorId = null, $fileName = null)
 {
     $contentPath = myContentStorage::getFSContentRootPath();
     // if entry type is audio - serve generic thumb:
     if ($this->getMediaType() == entry::ENTRY_MEDIA_TYPE_AUDIO) {
         if ($this->getStatus() == entryStatus::DELETED || $this->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK) {
             KalturaLog::log("rejected audio entry - not serving thumbnail");
             KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
         }
         $audioEntryExist = false;
         $audioThumbEntry = null;
         $audioThumbEntryId = null;
         $partner = $this->getPartner();
         if ($partner) {
             $audioThumbEntryId = $partner->getAudioThumbEntryId();
         }
         if ($audioThumbEntryId) {
             $audioThumbEntry = entryPeer::retrieveByPK($audioThumbEntryId);
         }
         if ($audioThumbEntry && $audioThumbEntry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
             $fileSyncVersion = $partner->getAudioThumbEntryVersion();
             $audioEntryKey = $audioThumbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $fileSyncVersion);
             $contentPath = kFileSyncUtils::getLocalFilePathForKey($audioEntryKey);
             if ($contentPath) {
                 $msgPath = $contentPath;
                 $audioEntryExist = true;
             } else {
                 KalturaLog::err('no local file sync for entry id');
             }
         }
         if (!$audioEntryExist) {
             $msgPath = $contentPath . "content/templates/entry/thumbnail/audio_thumb.jpg";
         }
         return myEntryUtils::resizeEntryImage($this, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $msgPath, $density, $stripProfiles);
     } elseif ($this->getMediaType() == entry::ENTRY_MEDIA_TYPE_SHOW) {
         // roughcut without any thumbnail, probably just created
         $msgPath = $contentPath . "content/templates/entry/thumbnail/auto_edit.jpg";
         return myEntryUtils::resizeEntryImage($this, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $msgPath, $density, $stripProfiles);
     } elseif ($this->getType() == entryType::MEDIA_CLIP) {
         try {
             return myEntryUtils::resizeEntryImage($this, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices);
         } catch (Exception $ex) {
             if ($ex->getCode() == kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC) {
                 // get original flavor asset
                 $origFlavorAsset = assetPeer::retrieveOriginalByEntryId($this->getId());
                 if ($origFlavorAsset) {
                     $syncKey = $origFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                     list($readyFileSync, $isLocal) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, TRUE, FALSE);
                     if ($readyFileSync) {
                         if ($isLocal) {
                             KalturaLog::err('Trying to redirect to myself - stop here.');
                             KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
                         }
                         //Ready fileSync is on the other DC - dumping
                         kFileUtils::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrlByDcId(1 - kDataCenterMgr::getCurrentDcId()));
                     }
                     KalturaLog::err('No ready fileSync found on any DC.');
                     KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
                 }
             }
         }
     }
 }
コード例 #30
0
 /**
  * add KalturaMediaEntry from email ingestion
  *
  * @action addMediaEntry
  * @param KalturaMediaEntry $mediaEntry Media entry metadata
  * @param string $uploadTokenId Upload token id
  * @param int $emailProfId
  * @param string $fromAddress
  * @param string $emailMsgId
  *
  * @return KalturaMediaEntry
  *
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  * @throws KalturaErrors::EMAIL_INGESTION_PROFILE_NOT_FOUND
  *
  */
 function addMediaEntryAction(KalturaMediaEntry $mediaEntry, $uploadTokenId, $emailProfId, $fromAddress, $emailMsgId)
 {
     try {
         // check that the uploaded file exists
         $entryFullPath = kUploadTokenMgr::getFullPathByUploadTokenId($uploadTokenId);
         if (!file_exists($entryFullPath)) {
             throw new KalturaAPIException(KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN);
         }
         // get the email profile by the given id
         $existingEIP = EmailIngestionProfilePeer::retrieveByPK($emailProfId);
         if (!$existingEIP) {
             throw new KalturaAPIException(KalturaErrors::EMAIL_INGESTION_PROFILE_NOT_FOUND, $emailProfId);
         }
         $emailIP = new KalturaEmailIngestionProfile();
         $emailIP->fromObject($existingEIP, $this->getResponseProfile());
         // handle defaults for media entry metadata
         $this->changeIfNull($mediaEntry->tags, $emailIP->defaultTags);
         $this->changeIfNull($mediaEntry->adminTags, $emailIP->defaultAdminTags);
         $this->changeIfNull($mediaEntry->conversionProfileId, $emailIP->conversionProfile2Id);
         $this->changeIfNull($mediaEntry->userId, $emailIP->defaultUserId);
         if (is_null($mediaEntry->categories) || is_null(categoryPeer::getByFullNameExactMatch($mediaEntry->categories))) {
             $mediaEntry->categories = $emailIP->defaultCategory;
         }
         // validate the input object
         //$entry->validatePropertyMinLength("name", 1);
         if (!$mediaEntry->name) {
             $mediaEntry->name = $this->getPartnerId() . '_' . time();
         }
         // first copy all the properties to the db entry, then we'll check for security stuff
         $dbEntry = $mediaEntry->toObject(new entry());
         if ($emailIP->moderationStatus == KalturaEntryModerationStatus::PENDING_MODERATION) {
             $dbEntry->setModerate(true);
         }
         $dbEntry->setType(KalturaEntryType::MEDIA_CLIP);
         $dbEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_AUTOMATIC);
         $this->checkAndSetValidUserInsert($mediaEntry, $dbEntry);
         $this->checkAdminOnlyInsertProperties($mediaEntry);
         $this->validateAccessControlId($mediaEntry);
         $this->validateEntryScheduleDates($mediaEntry, $dbEntry);
         $dbEntry->setPartnerId($this->getPartnerId());
         $dbEntry->setSubpId($this->getPartnerId() * 100);
         $dbEntry->setSourceId($uploadTokenId);
         $dbEntry->setSourceLink($entryFullPath);
         $dbEntry->setDefaultModerationStatus();
         $dbEntry->save();
         $te = new TrackEntry();
         $te->setEntryId($dbEntry->getId());
         $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY);
         $te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_EMAIL_INGESTION");
         $te->setParam1Str($fromAddress);
         $te->setParam2Str($emailMsgId);
         $te->setParam3Str($emailProfId . '::' . $emailIP->emailAddress . '::' . $emailIP->mailboxId);
         TrackEntry::addTrackEntry($te);
         $kshow = $this->createDummyKShow();
         $kshowId = $kshow->getId();
         myEntryUtils::setEntryTypeAndMediaTypeFromFile($dbEntry, $entryFullPath);
         // setup the needed params for my insert entry helper
         $paramsArray = array("entry_media_source" => KalturaSourceType::FILE, "entry_media_type" => $dbEntry->getMediaType(), "entry_full_path" => $entryFullPath, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
         $token = $this->getKsUniqueString();
         $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
         $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
         $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
         $dbEntry = $insert_entry_helper->getEntry();
         kUploadTokenMgr::closeUploadTokenById($uploadTokenId);
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry);
         $mediaEntry->fromObject($dbEntry, $this->getResponseProfile());
         return $mediaEntry;
     } catch (kCoreException $ex) {
         if ($ex->getCode() == kUploadTokenException::UPLOAD_TOKEN_INVALID_STATUS) {
         }
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY);
         throw $ex;
     }
 }