本文整理汇总了PHP中assetPeer::resetInstanceCriteriaFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::resetInstanceCriteriaFilter方法的具体用法?PHP assetPeer::resetInstanceCriteriaFilter怎么用?PHP assetPeer::resetInstanceCriteriaFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::resetInstanceCriteriaFilter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDownloadFileSyncAndLocal
/**
*
* @param $version
* @param $format
* @return FileSync
*/
public function getDownloadFileSyncAndLocal($version = NULL, $format = null, $sub_type = null)
{
$flavorParams = myConversionProfileUtils::getFlavorParamsFromFileFormat($this->getPartnerId(), $format);
if (!$flavorParams) {
return null;
}
assetPeer::resetInstanceCriteriaFilter();
$flavorAssets = assetPeer::retrieveByEntryIdAndParams($this->getId(), $flavorParams->getId());
if (!$flavorAssets) {
return null;
}
$syncKey = $flavorAssets->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (!$syncKey) {
return null;
}
return kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
}
示例2: entryDeleted
/**
* @param entry $entry
*/
protected function entryDeleted(entry $entry)
{
$this->syncableDeleted($entry->getId(), FileSyncObjectType::ENTRY);
// delete flavor assets
$c = new Criteria();
$c->add(assetPeer::ENTRY_ID, $entry->getId());
$c->add(assetPeer::STATUS, asset::FLAVOR_ASSET_STATUS_DELETED, Criteria::NOT_EQUAL);
$c->add(assetPeer::DELETED_AT, null, Criteria::ISNULL);
assetPeer::resetInstanceCriteriaFilter();
$assets = assetPeer::doSelect($c);
foreach ($assets as $asset) {
$asset->setStatus(asset::FLAVOR_ASSET_STATUS_DELETED);
$asset->setDeletedAt(time());
$asset->save();
}
$c = new Criteria();
$c->add(flavorParamsOutputPeer::ENTRY_ID, $entry->getId());
$c->add(flavorParamsOutputPeer::DELETED_AT, null, Criteria::ISNULL);
$flavorParamsOutputs = flavorParamsOutputPeer::doSelect($c);
foreach ($flavorParamsOutputs as $flavorParamsOutput) {
$flavorParamsOutput->setDeletedAt(time());
$flavorParamsOutput->save();
}
}
示例3: getAssetUrlAction
/**
* returns absolute valid url for asset file
*
* @action getAssetUrl
* @param string $assetId
* @return string
* @throws KalturaErrors::INVALID_OBJECT_ID
* @throws KalturaErrors::FLAVOR_ASSET_IS_NOT_READY
* @throws KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND
*/
function getAssetUrlAction($assetId)
{
assetPeer::resetInstanceCriteriaFilter();
$asset = assetPeer::retrieveById($assetId);
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $assetId);
}
$ext = $asset->getFileExt();
if (is_null($ext)) {
$ext = 'jpg';
}
$fileName = $asset->getEntryId() . "_" . $asset->getId() . ".{$ext}";
$syncKey = $asset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (!kFileSyncUtils::fileSync_exists($syncKey)) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_IS_NOT_READY, $asset->getId());
}
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
if (!$fileSync) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $asset->getId());
}
return $fileSync->getExternalUrl();
}
示例4: decideThumbGenerate
/**
* decideThumbGenerate is the decision layer for a single thumbnail generation
*
* @param entry $entry
* @param thumbParams $destThumbParams
* @param BatchJob $parentJob
* @return thumbAsset
*/
public static function decideThumbGenerate(entry $entry, thumbParams $destThumbParams, BatchJob $parentJob = null, $sourceAssetId = null, $runSync = false)
{
$srcAsset = null;
assetPeer::resetInstanceCriteriaFilter();
if ($sourceAssetId) {
$srcAsset = assetPeer::retrieveById($sourceAssetId);
} else {
if ($destThumbParams->getSourceParamsId()) {
KalturaLog::debug("Look for flavor params [" . $destThumbParams->getSourceParamsId() . "]");
$srcAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $destThumbParams->getSourceParamsId());
}
if (is_null($srcAsset)) {
KalturaLog::debug("Look for original flavor");
$srcAsset = flavorAssetPeer::retrieveOriginalByEntryId($entry->getId());
}
if (is_null($srcAsset) || $srcAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_READY) {
KalturaLog::debug("Look for highest bitrate flavor");
$srcAsset = flavorAssetPeer::retrieveHighestBitrateByEntryId($entry->getId());
}
}
if (is_null($srcAsset)) {
throw new APIException(APIErrors::FLAVOR_ASSET_IS_NOT_READY);
}
$errDescription = null;
$mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($srcAsset->getId());
$destThumbParamsOutput = self::validateThumbAndMediaInfo($destThumbParams, $mediaInfo, $errDescription);
$thumbAsset = thumbAssetPeer::retrieveByEntryIdAndParams($entry->getId(), $destThumbParams->getId());
if ($thumbAsset) {
$description = $thumbAsset->getDescription() . "\n" . $errDescription;
$thumbAsset->setDescription($description);
} else {
$thumbAsset = new thumbAsset();
$thumbAsset->setPartnerId($entry->getPartnerId());
$thumbAsset->setEntryId($entry->getId());
$thumbAsset->setDescription($errDescription);
$thumbAsset->setFlavorParamsId($destThumbParams->getId());
}
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_CONVERTING);
$thumbAsset->setTags($destThumbParamsOutput->getTags());
$thumbAsset->setFileExt($destThumbParamsOutput->getFileExt());
if (!$destThumbParamsOutput) {
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
$thumbAsset->save();
return null;
}
$thumbAsset->save();
// save flavor params
$destThumbParamsOutput->setPartnerId($entry->getPartnerId());
$destThumbParamsOutput->setEntryId($entry->getId());
$destThumbParamsOutput->setFlavorAssetId($thumbAsset->getId());
$destThumbParamsOutput->setFlavorAssetVersion($thumbAsset->getVersion());
$destThumbParamsOutput->save();
$srcSyncKey = $srcAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$srcAssetType = $srcAsset->getType();
if (!$runSync) {
$job = kJobsManager::addCapturaThumbJob($parentJob, $entry->getPartnerId(), $entry->getId(), $thumbAsset->getId(), $srcSyncKey, $srcAssetType, $destThumbParamsOutput);
return $thumbAsset;
}
$errDescription = null;
$capturedPath = self::generateThumbnail($srcAsset, $destThumbParamsOutput, $errDescription);
// failed
if (!$capturedPath) {
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
$thumbAsset->setDescription($thumbAsset->getDescription() . "\n{$errDescription}");
$thumbAsset->save();
return $thumbAsset;
}
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_READY);
if (file_exists($capturedPath)) {
list($width, $height, $type, $attr) = getimagesize($capturedPath);
$thumbAsset->setWidth($width);
$thumbAsset->setHeight($height);
$thumbAsset->setSize(filesize($capturedPath));
}
$logPath = $capturedPath . '.log';
if (file_exists($logPath)) {
$thumbAsset->incLogFileVersion();
$thumbAsset->save();
// creats the file sync
$logSyncKey = $thumbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
kFileSyncUtils::moveFromFile($logPath, $logSyncKey);
KalturaLog::debug("Log archived file to: " . kFileSyncUtils::getLocalFilePathForKey($logSyncKey));
} else {
$thumbAsset->save();
}
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::moveFromFile($capturedPath, $syncKey);
KalturaLog::debug("Thumbnail archived file to: " . kFileSyncUtils::getLocalFilePathForKey($syncKey));
if ($thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
//.........这里部分代码省略.........
示例5: serveByFlavorParamsIdAction
/**
* Serves the file content
*
* @action serveByFlavorParamsId
* @serverOnly
* @param string $entryId Document entry id
* @param string $flavorParamsId Flavor params id
* @param bool $forceProxy force to get the content without redirect
*
* @throws KalturaErrors::ENTRY_ID_NOT_FOUND
* @throws KalturaErrors::FLAVOR_ASSET_IS_NOT_READY
* @throws KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND
*/
public function serveByFlavorParamsIdAction($entryId, $flavorParamsId = null, $forceProxy = false)
{
KalturaResponseCacher::disableCache();
entryPeer::setDefaultCriteriaFilter();
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry || $dbEntry->getType() != entryType::DOCUMENT) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$ksObj = $this->getKs();
$ks = $ksObj ? $ksObj->getOriginalString() : null;
$securyEntryHelper = new KSecureEntryHelper($dbEntry, $ks, null);
$securyEntryHelper->validateForDownload();
$flavorAsset = null;
assetPeer::resetInstanceCriteriaFilter();
if ($flavorParamsId) {
$flavorAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $flavorParamsId);
if (!$flavorAsset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_IS_NOT_READY, $flavorParamsId);
}
} else {
$flavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (!$flavorAsset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $flavorParamsId);
}
}
$fileName = $dbEntry->getName() . '.' . $flavorAsset->getFileExt();
return $this->serveFlavorAsset($flavorAsset, $fileName, $forceProxy);
}