本文整理汇总了PHP中kFileSyncUtils::retrieveObjectForSyncKey方法的典型用法代码示例。如果您正苦于以下问题:PHP kFileSyncUtils::retrieveObjectForSyncKey方法的具体用法?PHP kFileSyncUtils::retrieveObjectForSyncKey怎么用?PHP kFileSyncUtils::retrieveObjectForSyncKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFileSyncUtils
的用法示例。
在下文中一共展示了kFileSyncUtils::retrieveObjectForSyncKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFilePathArr
/**
* will return a pair of file_root and file_path
*
* @param ISyncableFile $object
* @param int $subType
* @param int $storageProfileId
* @param $version
*/
public static function getFilePathArr(FileSyncKey $key, $storageProfileId = null)
{
KalturaLog::log(__METHOD__ . " - key [{$key}], storageProfileId [{$storageProfileId}]");
$storageProfile = self::getStorageProfile($storageProfileId);
if (is_null($storageProfile)) {
throw new Exception("Storage Profile [{$storageProfileId}] not found");
}
$pathManager = $storageProfile->getPathManager();
$object = kFileSyncUtils::retrieveObjectForSyncKey($key);
return $pathManager->generateFilePathArr($object, $key->object_sub_type, $key->version);
}
示例2: addCapturaThumbJob
/**
* @param BatchJob $parentJob
* @param int $partnerId
* @param string $entryId
* @param string $thumbAssetId
* @param FileSyncKey $srcSyncKey
* @param string $srcAssetId
* @param int $srcAssetType enum of assetType
* @param thumbParamsOutput $thumbParams
* @return BatchJob
*/
public static function addCapturaThumbJob(BatchJob $parentJob = null, $partnerId, $entryId, $thumbAssetId, FileSyncKey $srcSyncKey, $srcAssetId, $srcAssetType, thumbParamsOutput $thumbParams = null)
{
$thumbAsset = assetPeer::retrieveById($thumbAssetId);
if (!$thumbAsset) {
KalturaLog::err("No thumbnail asset found for id [{$thumbAssetId}]");
return null;
}
$partner = PartnerPeer::retrieveByPK($thumbAsset->getPartnerId());
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false);
if (!$fileSync) {
$thumbAsset->setStatus(asset::ASSET_STATUS_ERROR);
$thumbAsset->setDescription("Source file sync not found: {$srcSyncKey}");
$thumbAsset->save();
KalturaLog::err("Source file sync not found: {$srcSyncKey}");
return null;
}
if (!$local) {
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL && $partner && $partner->getImportRemoteSourceForConvert()) {
$url = $fileSync->getExternalUrl($entryId);
$originalAsset = kFileSyncUtils::retrieveObjectForSyncKey($srcSyncKey);
if ($originalAsset instanceof flavorAsset) {
KalturaLog::debug("Creates import job for remote file sync [{$url}]");
if ($thumbParams) {
$thumbParams->setSourceParamsId($originalAsset->getFlavorParamsId());
$thumbParams->save();
}
$thumbAsset->setStatus(asset::ASSET_STATUS_WAIT_FOR_CONVERT);
$thumbAsset->setDescription("Source file sync is importing: {$srcSyncKey}");
$thumbAsset->save();
return kJobsManager::addImportJob($parentJob, $thumbAsset->getEntryId(), $partner->getId(), $url, $originalAsset, null, null, true);
}
KalturaLog::debug("Downloading remote file sync [{$url}]");
$downloadPath = myContentStorage::getFSUploadsPath() . '/' . $thumbAsset->getId() . '.jpg';
if (KCurlWrapper::getDataFromFile($url, $downloadPath)) {
kFileSyncUtils::moveFromFile($downloadPath, $srcSyncKey);
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, false, false);
if (!$fileSync) {
throw new kCoreException("Source file not found for thumbnail capture [{$thumbAssetId}]", kCoreException::SOURCE_FILE_NOT_FOUND);
}
}
} else {
throw new kCoreException("Source file not found for thumbnail capture [{$thumbAssetId}]", kCoreException::SOURCE_FILE_NOT_FOUND);
}
}
$localPath = $fileSync->getFullPath();
$remoteUrl = $fileSync->getExternalUrl($entryId);
// creates convert data
$data = new kCaptureThumbJobData();
$data->setThumbAssetId($thumbAssetId);
$data->setSrcAssetId($srcAssetId);
$data->setSrcAssetType($srcAssetType);
$data->setSrcFileSyncLocalPath($localPath);
$data->setSrcFileSyncRemoteUrl($remoteUrl);
$data->setThumbParamsOutputId($thumbParams->getId());
$batchJob = null;
if ($parentJob) {
$batchJob = $parentJob->createChild(BatchJobType::CAPTURE_THUMB);
} else {
$batchJob = new BatchJob();
$batchJob->setEntryId($entryId);
$batchJob->setPartnerId($partnerId);
}
$batchJob->setObjectId($thumbAssetId);
$batchJob->setObjectType(BatchJobObjectType::ASSET);
return kJobsManager::addJob($batchJob, $data, BatchJobType::CAPTURE_THUMB);
}
示例3: handleDeleteFileFinished
/**
* @param BatchJob $dbBatchJob
* @param kConvertCollectionJobData $data
* @return BatchJob
*/
public static function handleDeleteFileFinished(BatchJob $dbBatchJob, kDeleteFileJobData $data)
{
KalturaLog::debug("File delete finished for file path: " . $data->getLocalFileSyncPath() . ", data center: " . $dbBatchJob->getDc());
//Change status of the filesync to "purged"
$fileSyncFroDeletedFile = kFileSyncUtils::retrieveObjectForSyncKey($data->getSyncKey());
$fileSyncFroDeletedFile->setStatus(FileSync::FILE_SYNC_STATUS_PURGED);
$fileSyncFroDeletedFile->save();
return $dbBatchJob;
}