public static function uploadFileByToken($file_data, $token, $filename, $extra_id = null, $create_thumb = false)
 {
     KalturaLog::log("Trace while uploading1 [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true));
     $origFilename = @$file_data['name'];
     if (!$origFilename) {
         KalturaLog::log("Error while uploading, file does not have a name. [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true) . "\nerror: [" . @$file_data["error"] . "]");
         return;
     }
     $parts = pathinfo($origFilename);
     $extension = @strtolower($parts['extension']);
     /*
     		$filename = $token .'_'. $filename;
     		// add the file extension after the "." character
     		$fullPath = myContentStorage::getFSUploadsPath().$filename . ( $extra_id ? "_" . $extra_id : "" ) .".".$extension;
     */
     list($fullPath, $fullUrl) = self::getUploadPathAndUrl($token, $filename, $extra_id, $extension);
     KalturaLog::log("Trace while uploading2 [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true) . "\n->[{$fullPath}]");
     // start tracking what will hopefully become an entry
     $te = new TrackEntry();
     $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_UPLOADED_FILE);
     $te->setParam1Str($token);
     $te->setParam2Str($filename);
     $te->setParam3Str($fullPath);
     $te->setDescription(__METHOD__ . ":" . __LINE__);
     TrackEntry::addTrackEntry($te);
     myContentStorage::fullMkdir($fullPath);
     if (!move_uploaded_file($file_data['tmp_name'], $fullPath)) {
         KalturaLog::log("Error while uploading [{$token}] [{$filename}] [{$extra_id}] [{$create_thumb}] " . print_r($file_data, true) . "\n->[{$fullPath}]");
         $err = array("token" => $token, "filename" => $filename, "origFilename" => $origFilename, "error" => @$file_data["error"]);
         KalturaLog::log("Error while uploading [{$token}] [{$filename}] [{$extra_id}] [{$create_thumb}] " . print_r($file_data, true) . "\n->[{$fullPath}]" . "\n" . print_r($err, true));
         return $err;
     }
     chmod($fullPath, 0777);
     $upload_server_header = isset($_SERVER["HTTP_X_KALTURA_SERVER"]) ? $_SERVER["HTTP_X_KALTURA_SERVER"] : null;
     $thumb_created = false;
     // if the file originated from a kaltura upload server we dont need a thumbnail (kuploader)
     if ($create_thumb && !$upload_server_header) {
         $thumbFullPath = self::getThumbnailPath($fullPath, ".jpg");
         kFile::fullMkdir($thumbFullPath);
         KalturaLog::log("Thumbnail full path [{$thumbFullPath}]");
         if (myContentStorage::fileExtAccepted($extension)) {
             KalturaLog::log("Generating image thumbnail");
             myFileConverter::createImageThumbnail($fullPath, $thumbFullPath, "image2");
             $thumb_url = self::getThumbnailPath($fullUrl, ".jpg");
             $thumb_created = file_exists($thumbFullPath);
         } elseif (myContentStorage::fileExtNeedConversion($extension)) {
             KalturaLog::log("Generating media thumbnail");
             myFileConverter::captureFrame($fullPath, $thumbFullPath, 1, "image2", -1, -1, 3);
             if (!file_exists($thumbFullPath)) {
                 myFileConverter::captureFrame($fullPath, $thumbFullPath, 1, "image2", -1, -1, 0);
             }
         }
     }
     if (!$thumb_created) {
         KalturaLog::log("Thumbnail not generated");
         // in this case no thumbnail was created - don't extract false data
         $thumb_url = "";
     }
     return array("token" => $token, "filename" => $filename, "origFilename" => $origFilename, "thumb_url" => $thumb_url, "thumb_created" => $thumb_created);
 }
 /**
  * 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;
     }
 }
Beispiel #3
0
 /**
  * @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);
 }
Beispiel #4
0
 /**
  * Adds track entry for investigations
  */
 protected function addTrackEntry()
 {
     $te = new TrackEntry();
     $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_UPLOADED_FILE);
     $te->setParam1Str($this->_uploadToken->getId());
     $te->setParam2Str($this->_uploadToken->getFileName());
     $te->setParam3Str($this->_uploadToken->getUploadTempPath());
     $te->setDescription(__METHOD__ . ":" . __LINE__);
     TrackEntry::addTrackEntry($te);
 }
 /**
  * @param entry $entry
  * @param entry $tempEntry
  */
 public static function replaceEntry(entry $entry, entry $tempEntry = null)
 {
     KalturaLog::debug("in replaceEntry");
     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());
     KalturaLog::debug("num of old assets: " . count($oldAssets));
     $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::debug("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::debug("Added new asset [" . $newAsset->getId() . "] for asset params [" . $newAsset->getFlavorParamsId() . "]");
         } else {
             $newAssets[$newAsset->getType()]['asset_' . count($newAssets[$newAsset->getType()])] = $newAsset;
             KalturaLog::debug("Added new asset [" . $newAsset->getId() . "] with no asset params");
         }
     }
     $saveEntry = false;
     $defaultThumbAssetNew = null;
     foreach ($oldAssets as $oldAsset) {
         /* @var $oldAsset asset */
         kFileSyncUtils::clearWAMSDataForKey($oldAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_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()];
             /* @var $newAsset asset */
             KalturaLog::debug("Create link from new asset [" . $newAsset->getId() . "] to old asset [" . $oldAsset->getId() . "] for flavor [" . $oldAsset->getFlavorParamsId() . "]");
             if ($oldAsset instanceof flavorAsset) {
                 $oldAsset->setBitrate($newAsset->getBitrate());
                 $oldAsset->setFrameRate($newAsset->getFrameRate());
                 $oldAsset->setVideoCodecId($newAsset->getVideoCodecId());
             }
             $oldAsset->setWidth($newAsset->getWidth());
             $oldAsset->setHeight($newAsset->getHeight());
             $oldAsset->setContainerFormat($newAsset->getContainerFormat());
             $oldAsset->setSize($newAsset->getSize());
             $oldAsset->setFileExt($newAsset->getFileExt());
             $oldAsset->setTags($newAsset->getTags());
             $oldAsset->setDescription($newAsset->getDescription());
             $oldAsset->incrementVersion();
             $oldAsset->setStatusLocalReady();
             $oldAsset->save();
             $oldFileSync = $oldAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
             $newFileSync = $newAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
             kFileSyncUtils::createSyncFileLinkForKey($oldFileSync, $newFileSync);
             $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::debug("Nominating ThumbAsset [" . $oldAsset->getId() . "] as the default ThumbAsset after replacent");
             }
         } elseif ($oldAsset instanceof flavorAsset || $oldAsset instanceof thumbAsset) {
             KalturaLog::debug("Delete old asset [" . $oldAsset->getId() . "] for paramsId [" . $oldAsset->getFlavorParamsId() . "]");
             $oldAsset->setStatus(flavorAsset::ASSET_STATUS_DELETED);
             $oldAsset->setDeletedAt(time());
             $oldAsset->save();
             $entry->removeFlavorParamsId($oldAsset->getFlavorParamsId());
             $saveEntry = true;
         }
     }
     foreach ($newAssets as $newAssetsByTypes) {
         foreach ($newAssetsByTypes as $newAsset) {
             $createdAsset = $newAsset->copyToEntry($entry->getId(), $entry->getPartnerId());
             KalturaLog::debug("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::debug("Nominating ThumbAsset [" . $newAsset->getId() . "] as the default ThumbAsset after replacent");
             }
         }
     }
     if ($defaultThumbAssetNew) {
         kBusinessConvertDL::setAsDefaultThumbAsset($defaultThumbAssetNew);
         kalturalog::debug("Setting ThumbAsset [" . $defaultThumbAssetNew->getId() . "] as the default ThumbAsset");
     } else {
         kalturalog::debug("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);
     }
     $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->setStatus($tempEntry->getStatus());
     $entry->save();
     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);
 }