本文整理匯總了PHP中myEntryUtils::copyData方法的典型用法代碼示例。如果您正苦於以下問題:PHP myEntryUtils::copyData方法的具體用法?PHP myEntryUtils::copyData怎麽用?PHP myEntryUtils::copyData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類myEntryUtils
的用法示例。
在下文中一共展示了myEntryUtils::copyData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addFromSearchResultAction
/**
* 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;
}
示例2: executeImpl
//.........這裏部分代碼省略.........
// 1. upload - the file is assumed to be in the upload directory and it's name is explicitly set in the fname$i param
// 2. webcam - the file is assumed to be in the webcam directory and it's name is explicitly set in the fname$i param
// 3. URL - the url is given in the entry_url$i param
/*
$media_source = $this->getParam('entry_media_source');
$media_type = $this->getParam('entry_media_type');
$entry_url = $this->getParam('entry_url');
$entry_source_link = $this->getParam('entry_source_link');
$entry_fileName = $this->getParam('entry_data');
$entry_thumbNum = $this->getParam('entry_thumb_num', 0);
$entry_thumbUrl = $this->getParam('entry_thumb_url', '');
$entry_from_time = $this->getParam('entry_from_time', 0);
$entry_to_time = $this->getParam('entry_to_time', 0);
$should_copy = $this->getParam('should_copy' , false );
$skip_conversion = $this->getParam('skip_conversion' , false );
*/
$paramsArray = array('entry_media_source' => $entry->getSource(), 'entry_media_type' => $entry->getMediaType());
// $entry_source = $entry->getSource() ;
if ($entry_source == entry::ENTRY_MEDIA_SOURCE_FILE) {
$paramsArray["entry_full_path"] = $entry_full_path;
} elseif ($entry_source == entry::ENTRY_MEDIA_SOURCE_WEBCAM) {
$file_alias = $this->getP($prefix . "filename");
$paramsArray["webcam_suffix"] = $file_alias;
$paramsArray['entry_from_time'] = $this->getP($prefix . "fromTime", 0);
$paramsArray['entry_to_time'] = $this->getP($prefix . "toTime", 0);
} elseif ($entry_source == entry::ENTRY_MEDIA_SOURCE_KALTURA || $entry_source == entry::ENTRY_MEDIA_SOURCE_KALTURA_PARTNER || $entry_source == entry::ENTRY_MEDIA_SOURCE_KALTURA_PARTNER_KSHOW || $entry_source == entry::ENTRY_MEDIA_SOURCE_KALTURA_KSHOW || $entry_source == entry::ENTRY_MEDIA_SOURCE_KALTURA_USER_CLIPS) {
// optimize - no need to actually go through the import and conversion phase
// find the source entry_id from the url
/*
$entry_url = $this->getP ( $prefix . "url" );
$entry_thumb_url = $this->getP ( $prefix . "thumbUrl" );
if ( myEntryUtils::copyData( $entry_url , $entry_thumb_url , $entry ) )
*/
$source_entry_id = $this->getP("media{$i}_id");
// $this->getP ( $prefix . "url" );
if ($source_entry_id === null) {
$source_entry_id = $entry->getMediaId();
}
if (myEntryUtils::copyData($source_entry_id, $entry)) {
// copy worked ok - no need to use insertEntryHelper
//$entry->setStatus ( entryStatus::READY );
// force the data to be ready even if the policy is to moderate - this is kaltura's content and was already approved
// (roman) true argument removed, so kaltura's content will be moderated according to partner's moderation settings
$entry->setStatusReady();
$insert = false;
$entry_modified = true;
$entry->save();
}
} elseif ($entry_source == entry::ENTRY_MEDIA_SOURCE_URL || in_array($entry_source, myMediaSourceFactory::getAllMediaSourceProvidersIds())) {
// the URL is relevant
$paramsArray["entry_url"] = $this->getP($prefix . "url");
$paramsArray["entry_thumb_url"] = $this->getP($prefix . "thumbUrl");
// TODO - these fields are already set in the entry -
// the code in myInsertEntryHelper is redundant
$paramsArray["entry_license"] = $entry->getLicenseType();
$paramsArray["entry_credit"] = $entry->getCredit();
$paramsArray["entry_source_link"] = $entry->getSourceLink();
$paramsArray["entry_tags"] = $entry->getTags();
} else {
$this->addError(APIErrors::UNKNOWN_MEDIA_SOURCE, $entry->getSource());
$insert = false;
}
if ($insert) {
KalturaLog::err("paramsArray" . print_r($paramsArray, true));