本文整理汇总了PHP中assetPeer::retrieveByEntryIdAndStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveByEntryIdAndStatus方法的具体用法?PHP assetPeer::retrieveByEntryIdAndStatus怎么用?PHP assetPeer::retrieveByEntryIdAndStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveByEntryIdAndStatus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleConvertFinished
//.........这里部分代码省略.........
KalturaLog::debug("required flavor params ids [" . print_r($requiredFlavorParamsIds, true) . "]");
// go over all the flavor assets of the entry
$entry = $currentFlavorAsset->getentry();
$inCompleteFlavorIds = array();
$origianlAssetFlavorId = null;
$siblingFlavorAssets = assetPeer::retrieveFlavorsByEntryId($currentFlavorAsset->getEntryId());
foreach ($siblingFlavorAssets as $siblingFlavorAsset) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] flavor params id [" . $siblingFlavorAsset->getFlavorParamsId() . "]");
// don't mark any incomplete flag
if ($siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is ready");
if (isset($requiredFlavorParamsIds[$siblingFlavorAsset->getFlavorParamsId()])) {
unset($requiredFlavorParamsIds[$siblingFlavorAsset->getFlavorParamsId()]);
}
continue;
}
if ($entry->getReplacedEntryId() && $siblingFlavorAsset->getStatus() == flavorAsset::ASSET_STATUS_QUEUED) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is incomplete and in replacement");
$inCompleteFlavorIds[] = $siblingFlavorAsset->getFlavorParamsId();
}
$readyBehavior = self::getReadyBehavior($siblingFlavorAsset, $profile);
if ($siblingFlavorAsset->getStatus() == flavorAsset::ASSET_STATUS_EXPORTING) {
if ($siblingFlavorAsset->getIsOriginal()) {
$origianlAssetFlavorId = $siblingFlavorAsset->getFlavorParamsId();
} else {
if ($readyBehavior != flavorParamsConversionProfile::READY_BEHAVIOR_IGNORE) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is incomplete");
$inCompleteFlavorIds[] = $siblingFlavorAsset->getFlavorParamsId();
}
}
}
if ($readyBehavior == flavorParamsConversionProfile::READY_BEHAVIOR_IGNORE) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is ignored");
continue;
}
if ($siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_QUEUED || $siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_CONVERTING || $siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_IMPORTING || $siblingFlavorAsset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_VALIDATING || $siblingFlavorAsset->getStatus() == flavorAsset::ASSET_STATUS_WAIT_FOR_CONVERT) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is incomplete");
$inCompleteFlavorIds[] = $siblingFlavorAsset->getFlavorParamsId();
}
if ($readyBehavior == flavorParamsConversionProfile::READY_BEHAVIOR_REQUIRED) {
KalturaLog::debug("sibling flavor asset id [" . $siblingFlavorAsset->getId() . "] is required");
$requiredFlavorParamsIds[$siblingFlavorAsset->getFlavorParamsId()] = true;
}
}
KalturaLog::debug("left required flavor params ids [" . print_r($requiredFlavorParamsIds, true) . "]");
KalturaLog::debug("left incomplete flavor ids [" . print_r($inCompleteFlavorIds, true) . "]");
if (count($requiredFlavorParamsIds)) {
$inCompleteRequiredFlavorParamsIds = array_keys($requiredFlavorParamsIds);
foreach ($inCompleteRequiredFlavorParamsIds as $inCompleteFlavorId) {
$inCompleteFlavorIds[] = $inCompleteFlavorId;
}
KalturaLog::debug('Convert Finished - has In-Complete Required flavors [[' . print_r($inCompleteRequiredFlavorParamsIds, true) . ']');
} elseif ($currentFlavorAsset->getStatus() == asset::ASSET_STATUS_READY && ($currentReadyBehavior == flavorParamsConversionProfile::READY_BEHAVIOR_OPTIONAL || $currentReadyBehavior == flavorParamsConversionProfile::READY_BEHAVIOR_REQUIRED)) {
// mark the entry as ready if all required conversions completed or any of the optionals
if ($currentFlavorAsset->getentry()->getReplacedEntryId()) {
KalturaLog::debug('Entry is temporary replacement and requires all flavors to complete');
} else {
KalturaLog::debug('Mark the entry as ready');
kBatchManager::updateEntry($currentFlavorAsset->getEntryId(), entryStatus::READY);
}
}
if ($origianlAssetFlavorId) {
$inCompleteFlavorIds = array_diff($inCompleteFlavorIds, array($origianlAssetFlavorId));
}
if (!count($inCompleteFlavorIds)) {
KalturaLog::debug('Convert Finished');
if ($origianlAssetFlavorId && $rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
kStorageExporter::exportSourceAssetFromJob($rootBatchJob);
} else {
// mark the context root job as finished only if all conversion jobs are completed
kBatchManager::updateEntry($currentFlavorAsset->getEntryId(), entryStatus::READY);
if ($rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
kJobsManager::updateBatchJob($rootBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
}
}
return $dbBatchJob;
}
KalturaLog::debug('Convert Finished - has In-Complete flavors [' . print_r($inCompleteFlavorIds, true) . ']');
if (!$rootBatchJob || $rootBatchJob->getJobType() != BatchJobType::CONVERT_PROFILE) {
return $dbBatchJob;
}
$childJobs = $rootBatchJob->getChildJobs();
KalturaLog::debug('Child jobs found [' . count($childJobs) . ']');
$waitingFlavorAssets = assetPeer::retrieveByEntryIdAndStatus($currentFlavorAsset->getEntryId(), flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT);
KalturaLog::debug('Waiting assets found [' . count($waitingFlavorAssets) . ']');
if (count($childJobs) > 1 && count($waitingFlavorAssets) < 1) {
$allDone = true;
foreach ($childJobs as $childJob) {
if ($childJob->getId() != $rootBatchJob->getId() && $childJob->getStatus() != BatchJob::BATCHJOB_STATUS_FINISHED) {
KalturaLog::debug('Child job id [' . $childJob->getId() . '] status [' . $childJob->getStatus() . ']');
$allDone = false;
}
}
if ($allDone) {
KalturaLog::debug('All child jobs done, closing profile');
kJobsManager::updateBatchJob($rootBatchJob, BatchJob::BATCHJOB_STATUS_FINISHED);
}
}
return $dbBatchJob;
}
示例2: fixIsmManifestForReplacedEntry
private function fixIsmManifestForReplacedEntry($path)
{
$fileData = file_get_contents($path);
$xml = new SimpleXMLElement($fileData);
$ismcFileName = $xml->head->meta['content'];
list($ismcObjectId, $version, $subType, $isAsset, $entryId) = $this->parseObjectId($ismcFileName);
if ($entryId != $this->entry->getId()) {
//replacement flow
$flavorAssets = assetPeer::retrieveByEntryIdAndStatus($this->entry->getId(), asset::ASSET_STATUS_READY);
foreach ($flavorAssets as $asset) {
if ($asset->hasTag(assetParams::TAG_ISM_MANIFEST)) {
list($replacingFileName, $fileName) = $this->getReplacedAndReplacingFileNames($asset, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
if ($replacingFileName && $fileName) {
$fileData = str_replace("content=\"{$replacingFileName}\"", "content=\"{$fileName}\"", $fileData);
}
} else {
list($replacingFileName, $fileName) = $this->getReplacedAndReplacingFileNames($asset, flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
if ($replacingFileName && $fileName) {
$fileData = str_replace("src=\"{$replacingFileName}\"", "src=\"{$fileName}\"", $fileData);
}
}
}
return $fileData;
} else {
return $fileData;
}
}
示例3: handleImportFinished
/**
* @param BatchJob $dbBatchJob
* @param kImportJobData $data
* @return BatchJob
*/
public static function handleImportFinished(BatchJob $dbBatchJob, kImportJobData $data)
{
if ($dbBatchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED) {
return $dbBatchJob;
}
if (!file_exists($data->getDestFileLocalPath())) {
throw new APIException(APIErrors::INVALID_FILE_NAME, $data->getDestFileLocalPath());
}
// get entry
$entryId = $dbBatchJob->getEntryId();
$dbEntry = entryPeer::retrieveByPKNoFilter($entryId);
// IMAGE media entries
if ($dbEntry->getType() == entryType::MEDIA_CLIP && $dbEntry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
//setting the entry's data so it can be used for creating file-syncs' file-path version & extension - in kFileSyncUtils::moveFromFile
//without saving - the updated entry object exists in the instance pool
$dbEntry->setData(".jpg");
$syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
try {
kFileSyncUtils::moveFromFile($data->getDestFileLocalPath(), $syncKey, true, false, $data->getCacheOnly());
} catch (Exception $e) {
if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
$dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
$dbEntry->save();
}
throw $e;
}
$dbEntry->setStatus(entryStatus::READY);
$dbEntry->save();
return $dbBatchJob;
}
$flavorAsset = null;
if ($data->getFlavorAssetId()) {
$flavorAsset = assetPeer::retrieveById($data->getFlavorAssetId());
}
$isNewFlavor = false;
if (!$flavorAsset) {
$msg = null;
$flavorAsset = kFlowHelper::createOriginalFlavorAsset($dbBatchJob->getPartnerId(), $dbBatchJob->getEntryId(), $msg);
if (!$flavorAsset) {
KalturaLog::err("Flavor asset not created for entry [" . $dbBatchJob->getEntryId() . "]");
kBatchManager::updateEntry($dbBatchJob->getEntryId(), entryStatus::ERROR_CONVERTING);
$dbBatchJob->setMessage($msg);
$dbBatchJob->setDescription($dbBatchJob->getDescription() . "\n" . $msg);
return $dbBatchJob;
}
$isNewFlavor = true;
}
$isNewContent = true;
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$isNewContent = false;
}
$ext = pathinfo($data->getDestFileLocalPath(), PATHINFO_EXTENSION);
KalturaLog::info("Imported file extension: {$ext}");
if (!$flavorAsset->getVersion()) {
$flavorAsset->incrementVersion();
}
if ($ext) {
$flavorAsset->setFileExt($ext);
}
if ($flavorAsset instanceof thumbAsset) {
list($width, $height, $type, $attr) = getimagesize($data->getDestFileLocalPath());
$flavorAsset->setWidth($width);
$flavorAsset->setHeight($height);
$flavorAsset->setSize(filesize($data->getDestFileLocalPath()));
}
$flavorAsset->save();
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::moveFromFile($data->getDestFileLocalPath(), $syncKey, true, false, $data->getCacheOnly());
// set the path in the job data
$localFilePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
$data->setDestFileLocalPath($localFilePath);
$data->setFlavorAssetId($flavorAsset->getId());
$dbBatchJob->setData($data);
$dbBatchJob->save();
$convertProfileExist = self::activateConvertProfileJob($dbBatchJob->getEntryId(), $localFilePath);
if (($isNewContent || $dbEntry->getStatus() == entryStatus::IMPORT) && !$convertProfileExist) {
// check if status == import for importing file of type url (filesync exists, and we want to raise event for conversion profile to start)
kEventsManager::raiseEvent(new kObjectAddedEvent($flavorAsset, $dbBatchJob));
}
if (!$isNewFlavor) {
$entryFlavors = assetPeer::retrieveByEntryIdAndStatus($flavorAsset->getEntryId(), flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT);
$originalFlavorAsset = assetPeer::retrieveOriginalByEntryId($flavorAsset->getEntryId());
foreach ($entryFlavors as $entryFlavor) {
/* @var $entryFlavor flavorAsset */
if ($entryFlavor->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_WAIT_FOR_CONVERT && $entryFlavor->getFlavorParamsId()) {
$flavor = assetParamsOutputPeer::retrieveByAsset($entryFlavor);
kBusinessPreConvertDL::decideFlavorConvert($entryFlavor, $flavor, $originalFlavorAsset, null, null, $dbBatchJob);
}
}
$entryThumbnails = assetPeer::retrieveThumbnailsByEntryId($flavorAsset->getEntryId());
foreach ($entryThumbnails as $entryThumbnail) {
/* @var $entryThumbnail thumbAsset */
if ($entryThumbnail->getStatus() != asset::ASSET_STATUS_WAIT_FOR_CONVERT || !$entryThumbnail->getFlavorParamsId()) {
continue;
//.........这里部分代码省略.........