本文整理汇总了PHP中FileSyncPeer类的典型用法代码示例。如果您正苦于以下问题:PHP FileSyncPeer类的具体用法?PHP FileSyncPeer怎么用?PHP FileSyncPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileSyncPeer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: validateEntry
public function validateEntry(entry $dbEntry)
{
parent::validateEntry($dbEntry);
$this->validatePropertyNotNull('entryId');
$srcEntry = entryPeer::retrieveByPK($this->entryId);
if (!$srcEntry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryId);
}
if ($srcEntry->getMediaType() == KalturaMediaType::IMAGE) {
return parent::validateEntry($dbEntry);
}
$srcFlavorAsset = null;
if (is_null($this->flavorParamsId)) {
$srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($this->entryId);
if (!$srcFlavorAsset) {
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
}
} else {
$srcFlavorAsset = assetPeer::retrieveByEntryIdAndParams($this->entryId, $this->flavorParamsId);
if (!$srcFlavorAsset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $this->assetId);
}
}
$key = $srcFlavorAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->addAnd(FileSyncPeer::FILE_TYPE, array(FileSync::FILE_SYNC_FILE_TYPE_FILE, FileSync::FILE_SYNC_FILE_TYPE_LINK), Criteria::IN);
$fileSyncs = FileSyncPeer::doSelect($c);
foreach ($fileSyncs as $fileSync) {
$fileSync = kFileSyncUtils::resolve($fileSync);
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
return;
}
}
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:35,代码来源:KalturaEntryResource.php
示例2: objectAdded
/**
* @param BaseObject $object
* @return bool true if should continue to the next consumer
*/
public function objectAdded(BaseObject $object)
{
if (!$object instanceof FileSync || $object->getStatus() != FileSync::FILE_SYNC_STATUS_PENDING || $object->getFileType() != FileSync::FILE_SYNC_FILE_TYPE_FILE || $object->getDc() == kDataCenterMgr::getCurrentDcId()) {
return true;
}
$c = new Criteria();
$c->addAnd(FileSyncPeer::OBJECT_ID, $object->getObjectId());
$c->addAnd(FileSyncPeer::VERSION, $object->getVersion());
$c->addAnd(FileSyncPeer::OBJECT_TYPE, $object->getObjectType());
$c->addAnd(FileSyncPeer::OBJECT_SUB_TYPE, $object->getObjectSubType());
$c->addAnd(FileSyncPeer::ORIGINAL, '1');
$original_filesync = FileSyncPeer::doSelectOne($c);
if (!$original_filesync) {
KalturaLog::err('Original filesync not found for object_id[' . $object->getObjectId() . '] version[' . $object->getVersion() . '] type[' . $object->getObjectType() . '] subtype[' . $object->getObjectSubType() . ']');
return true;
}
$sourceFileUrl = $original_filesync->getExternalUrl();
if (!$sourceFileUrl) {
KalturaLog::err('External URL not found for filesync id [' . $object->getId() . ']');
return true;
}
$job = kMultiCentersManager::addFileSyncImportJob($this->getEntryId($object), $object->getPartnerId(), $object->getId(), $sourceFileUrl);
$job->setDc($object->getDc());
$job->save();
return true;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:30,代码来源:kMultiCentersSynchronizer.php
示例3: syncAction
/**
* @action sync
* @param int $fileSyncId
* @param file $fileData
* @return KalturaFileSync
*/
function syncAction($fileSyncId, $fileData)
{
$dbFileSync = FileSyncPeer::retrieveByPK($fileSyncId);
if (!$dbFileSync) {
throw new APIException(APIErrors::INVALID_FILE_SYNC_ID, $fileSyncId);
}
$key = kFileSyncUtils::getKeyForFileSync($dbFileSync);
kFileSyncUtils::moveFromFile($fileData['tmp_name'], $key, false);
list($file_root, $real_path) = kPathManager::getFilePathArr($key);
$full_path = $file_root . $real_path;
chmod($full_path, 0644);
if (file_exists($full_path)) {
$dbFileSync->setFileRoot($file_root);
$dbFileSync->setFilePath($real_path);
$dbFileSync->setFileSizeFromPath($full_path);
$dbFileSync->setStatus(FileSync::FILE_SYNC_STATUS_READY);
} else {
$dbFileSync->setFileSize(-1);
$dbFileSync->setStatus(FileSync::FILE_SYNC_STATUS_ERROR);
}
$dbFileSync->save();
$fileSync = new KalturaFileSync();
$fileSync->fromObject($dbFileSync);
return $fileSync;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:FileSyncService.php
示例4: clearMemory
public function clearMemory()
{
accessControlPeer::clearInstancePool();
BatchJobPeer::clearInstancePool();
BulkUploadResultPeer::clearInstancePool();
categoryPeer::clearInstancePool();
EmailIngestionProfilePeer::clearInstancePool();
entryPeer::clearInstancePool();
FileSyncPeer::clearInstancePool();
flavorAssetPeer::clearInstancePool();
flavorParamsConversionProfilePeer::clearInstancePool();
flavorParamsOutputPeer::clearInstancePool();
flavorParamsPeer::clearInstancePool();
kshowPeer::clearInstancePool();
mediaInfoPeer::clearInstancePool();
moderationFlagPeer::clearInstancePool();
moderationPeer::clearInstancePool();
notificationPeer::clearInstancePool();
roughcutEntryPeer::clearInstancePool();
SchedulerConfigPeer::clearInstancePool();
SchedulerPeer::clearInstancePool();
SchedulerStatusPeer::clearInstancePool();
SchedulerWorkerPeer::clearInstancePool();
StorageProfilePeer::clearInstancePool();
syndicationFeedPeer::clearInstancePool();
TrackEntryPeer::clearInstancePool();
uiConfPeer::clearInstancePool();
UploadTokenPeer::clearInstancePool();
// TODO clear default filters
// TODO call all memory cleaner plugins
if (function_exists('gc_collect_cycles')) {
// php 5.3 and above
gc_collect_cycles();
}
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:35,代码来源:KalturaDispatcher.php
示例5: execute
/**
* Serves multiple files for synchronization between datacenters
*/
public function execute()
{
$fileSyncIds = $this->getRequestParameter("ids");
$hash = $this->getRequestParameter("hash");
// validate hash
$currentDc = kDataCenterMgr::getCurrentDc();
$currentDcId = $currentDc["id"];
$expectedHash = md5($currentDc["secret"] . $fileSyncIds);
if ($hash !== $expectedHash) {
$error = "Invalid hash - ids [{$fileSyncIds}] got [{$hash}] expected [{$expectedHash}]";
KalturaLog::err($error);
KExternalErrors::dieError(KExternalErrors::INVALID_TOKEN);
}
// load file syncs
$fileSyncs = FileSyncPeer::retrieveByPks(explode(',', $fileSyncIds));
if ($fileSyncs) {
KalturaMonitorClient::initApiMonitor(false, 'extwidget.serveMultiFile', $fileSyncs[0]->getPartnerId());
}
// resolve file syncs
$filePaths = array();
foreach ($fileSyncs as $fileSync) {
if ($fileSync->getDc() != $currentDcId) {
$error = "FileSync id [" . $fileSync->getId() . "] does not belong to this DC";
KalturaLog::err($error);
KExternalErrors::dieError(KExternalErrors::BAD_QUERY);
}
// resolve if file_sync is link
$fileSyncResolved = kFileSyncUtils::resolve($fileSync);
// check if file sync path leads to a file or a directory
$resolvedPath = $fileSyncResolved->getFullPath();
if (is_dir($resolvedPath)) {
$error = "FileSync id [" . $fileSync->getId() . "] is a directory";
KalturaLog::err($error);
KExternalErrors::dieError(KExternalErrors::BAD_QUERY);
}
if (!file_exists($resolvedPath)) {
$error = "Path [{$resolvedPath}] for fileSync id [" . $fileSync->getId() . "] does not exist";
KalturaLog::err($error);
continue;
}
$filePaths[$fileSync->getId()] = $resolvedPath;
}
$boundary = md5(uniqid('', true));
header('Content-Type: multipart/form-data; boundary=' . $boundary);
foreach ($filePaths as $id => $filePath) {
echo "--{$boundary}\n";
echo "Content-Type: application/octet-stream\n";
echo "Content-Disposition: form-data; name=\"{$id}\"\n\n";
readfile($filePath);
echo "\n";
}
echo "--{$boundary}--\n";
KExternalErrors::dieGracefully();
}
开发者ID:DBezemer,项目名称:server,代码行数:57,代码来源:serveMultiFileAction.class.php
示例6: __construct
/**
* @param string $srcWAMSAssetId
* @param string $targetPath
*/
public function __construct($srcWAMSAssetId, $targetPath)
{
KalturaLog::debug("Creation instance of KWAMSThumbnailMaker srcWAMSAssetId = [{$srcWAMSAssetId}] targetPath = [{$targetPath}]");
$this->srcWAMSAssetId = $srcWAMSAssetId;
$this->targetPath = $targetPath;
DbManager::setConfig(kConf::getDB());
DbManager::initialize();
$fileSync = FileSyncPeer::retrieveByWamsAssetId($srcWAMSAssetId);
if (!empty($fileSync)) {
$this->partnerId = $fileSync->getPartnerId();
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:16,代码来源:KWAMSThumbnailMaker.php
示例7: syncableDeleted
/**
* @param string $id
* @param int $type
*/
protected function syncableDeleted($id, $type)
{
$c = new Criteria();
$c->add(FileSyncPeer::OBJECT_ID, $id);
$c->add(FileSyncPeer::OBJECT_TYPE, $type);
$c->add(FileSyncPeer::STATUS, array(FileSync::FILE_SYNC_STATUS_PURGED, FileSync::FILE_SYNC_STATUS_DELETED), Criteria::NOT_IN);
$fileSyncs = FileSyncPeer::doSelect($c);
foreach ($fileSyncs as $fileSync) {
$key = kFileSyncUtils::getKeyForFileSync($fileSync);
kFileSyncUtils::deleteSyncFileForKey($key);
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:16,代码来源:kObjectDeleteHandler.php
示例8: updateAction
/**
* Update file sync by id
*
* @action update
* @param int $id
* @param KalturaFileSync $fileSync
* @return KalturaFileSync
*
* @throws FileSyncErrors::FILESYNC_ID_NOT_FOUND
*/
function updateAction($id, KalturaFileSync $fileSync)
{
$dbFileSync = FileSyncPeer::retrieveByPK($id);
if (!$dbFileSync) {
throw new KalturaAPIException(FileSyncErrors::FILESYNC_ID_NOT_FOUND, $id);
}
$fileSync->toUpdatableObject($dbFileSync);
$dbFileSync->save();
$fileSync = new KalturaFileSync();
$fileSync->fromObject($dbFileSync, $this->getResponseProfile());
return $fileSync;
}
开发者ID:DBezemer,项目名称:server,代码行数:22,代码来源:FileSyncService.php
示例9: resumeEvents
private function resumeEvents($flavorAsset)
{
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$c = FileSyncPeer::getCriteriaForFileSyncKey($syncKey);
$fileSyncList = FileSyncPeer::doSelect($c);
foreach ($fileSyncList as $fileSync) {
// resume file sync added event
kEventsManager::continueEvent(new kObjectAddedEvent($fileSync), 'kVirusScanFlowManager');
}
// resume flavor asset added event consumption
kEventsManager::continueEvent(new kObjectAddedEvent($flavorAsset), 'kVirusScanFlowManager');
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:12,代码来源:kVirusScanFlowManager.php
示例10: getAllReadyInternalFileSyncsForKey
function getAllReadyInternalFileSyncsForKey(FileSyncKey $key)
{
$c = new Criteria();
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->addAnd(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_FILE);
$c->addAnd(FileSyncPeer::STATUS, FileSync::FILE_SYNC_STATUS_READY);
$results = FileSyncPeer::doSelect($c);
$assocResults = array();
foreach ($results as $curResult) {
$assocResults[$curResult->getDc()] = $curResult;
}
return $assocResults;
}
开发者ID:DBezemer,项目名称:server,代码行数:13,代码来源:moveConvertJobs.php
示例11: getExclusiveFileSyncImportJobsAction
/**
* batch getExclusiveFileSyncImportJob action allows to get a BatchJob of type FILESYNC_IMPORT
*
* @action getExclusiveFileSyncImportJobs
* @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism
* @param int $maxExecutionTime The maximum time in seconds the job reguarly take. Is used for the locking mechanism when determining an unexpected termination of a batch-process.
* @param int $numberOfJobs The maximum number of jobs to return.
* @param KalturaBatchJobFilter $filter Set of rules to fetch only rartial list of jobs
* @param int $maxOffset The maximum offset we accept for the distance from the best result.
* @return KalturaBatchJobArray
*
* TODO remove the destFilePath from the job data and get it later using the api, then delete this method
*/
function getExclusiveFileSyncImportJobsAction(KalturaExclusiveLockKey $lockKey, $maxExecutionTime, $numberOfJobs, KalturaBatchJobFilter $filter = null, $maxOffset = null)
{
$coreJobs = $this->getExclusiveJobs($lockKey, $maxExecutionTime, $numberOfJobs, $filter, BatchJobType::FILESYNC_IMPORT, $maxOffset);
$jobs = KalturaBatchJobArray::fromBatchJobArray($coreJobs);
if ($jobs) {
foreach ($jobs as $index => $job) {
$data = $job->data;
// try to get destination path from file sync
$fileSyncId = $data->filesyncId;
$fileSync = FileSyncPeer::retrieveByPK($fileSyncId);
if (!$fileSync) {
KalturaLog::err("Failed to load file sync [{$fileSyncId}] aborting job [{$job->id}]");
$dbJob = BatchJobPeer::retrieveByPK($job->id);
$dbJob->setMessage("Failed to load file sync [{$fileSyncId}]");
kJobsManager::abortDbBatchJob($dbJob);
unset($jobs[$index]);
continue;
}
$fileSyncRoot = $fileSync->getFileRoot();
$fileSyncPath = $fileSync->getFilePath();
if ($fileSyncRoot && $fileSyncPath) {
// destination path set on filesync
$dest_path = $fileSyncRoot . $fileSyncPath;
} else {
// not set on filesync - get path from path manager
$fileSyncKey = kFileSyncUtils::getKeyForFileSync($fileSync);
list($file_root, $real_path) = kPathManager::getFilePathArr($fileSyncKey);
$dest_path = $file_root . $real_path;
// update filesync on database
$fileSync->setFileRoot($file_root);
$fileSync->setFilePath($real_path);
$fileSync->save();
}
// update job data with destination path if needed
if (!$data->destFilePath) {
$data->destFilePath = $dest_path;
$job->data = $data;
KalturaLog::log('Updating destination path for job id [$job->id]');
$this->updateJob($job);
}
if (!is_dir(dirname($dest_path)) && !@mkdir(dirname($dest_path), 0755, true)) {
KalturaLog::ERR("Cannot create directory [{$dest_path}] - " . error_get_last());
}
}
}
return $jobs;
}
开发者ID:AdiTal,项目名称:server,代码行数:60,代码来源:FileSyncImportBatchService.php
示例12: deleteObject
function deleteObject(FileSync $fileSync)
{
$object = kFileSyncUtils::retrieveObjectForFileSync($fileSync);
$key = $object->getSyncKey($fileSync->getObjectSubType());
if ($key->version != $fileSync->getVersion()) {
return;
}
switch ($fileSync->getObjectType()) {
case FileSyncObjectType::UICONF:
$object->setStatus(uiConf::UI_CONF_STATUS_DELETED);
$object->save();
break;
case FileSyncObjectType::ENTRY:
myEntryUtils::deleteEntry($object);
try {
$wrapper = objectWrapperBase::getWrapperClass($object);
$wrapper->removeFromCache("entry", $object->getId());
} catch (Exception $e) {
KalturaLog::err($e);
}
break;
case FileSyncObjectType::ASSET:
$object->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_DELETED);
$object->setDeletedAt(time());
$object->save();
break;
case FileSyncObjectType::METADATA:
$object->setStatus(Metadata::STATUS_DELETED);
$object->save();
break;
default:
return;
}
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_LINK) {
return;
}
$criteria = new Criteria();
$criteria->add(FileSyncPeer::DC, $fileSync->getDc());
$criteria->add(FileSyncPeer::FILE_TYPE, FileSync::FILE_SYNC_FILE_TYPE_LINK);
$criteria->add(FileSyncPeer::LINKED_ID, $fileSync->getId());
$links = FileSyncPeer::doSelect($criteria);
foreach ($links as $link) {
deleteObject($link);
}
}
开发者ID:DBezemer,项目名称:server,代码行数:45,代码来源:validateFileSyncs.php
示例13: updatedJob
public function updatedJob(BatchJob $dbBatchJob)
{
switch ($dbBatchJob->getStatus()) {
case BatchJob::BATCHJOB_STATUS_FINISHED:
$data = $dbBatchJob->getData();
$kontikiFileSync = FileSyncPeer::retrieveByPK($data->getSrcFileSyncId());
/* @var $data kStorageExportJobData */
$asset = assetPeer::retrieveByFileSync($kontikiFileSync);
$asset->setTags(KontikiPlugin::KONTIKI_ASSET_TAG);
$asset->save();
//Get Kontiki file sync and set the external URL
$kontikiFileSync->setFileRoot("");
$kontikiFileSync->setFilePath($data->getContentMoid());
$kontikiFileSync->save();
break;
}
return true;
}
开发者ID:DBezemer,项目名称:server,代码行数:18,代码来源:kKontikiManager.php
示例14: updatedFileSyncImportFailed
protected function updatedFileSyncImportFailed(BatchJob $dbBatchJob, kFileSyncImportJobData $data, BatchJob $twinJob = null)
{
// Update relevant filesync as FAILED
$fileSyncId = $data->getFilesyncId();
if (!$fileSyncId) {
KalturaLog::err('File sync ID not found in job data.');
throw new KalturaAPIException(MultiCentersErrors::INVALID_FILESYNC_ID);
}
$fileSync = FileSyncPeer::retrieveByPK($fileSyncId);
if (!$fileSync) {
KalturaLog::err("Invalid filesync record with id [{$fileSyncId}]");
throw new KalturaAPIException(MultiCentersErrors::INVALID_FILESYNC_RECORD, $fileSyncId);
}
$fileSync->setStatus(FileSync::FILE_SYNC_STATUS_ERROR);
$fileSync->setReadyAt(time());
$fileSync->save();
return $dbBatchJob;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:18,代码来源:kMultiCentersFlowManager.php
示例15: __construct
/**
* Creates instance of class and initializes properties
* @param string $type
* @param string $filePath
* @param KSchedularTaskConfig $taskConfig
*/
public function __construct($type, $filePath, KSchedularTaskConfig $taskConfig, KalturaBatchJob $job, $wamsAssetId)
{
$this->wamsAssetId = $wamsAssetId;
$this->filePath = $filePath;
$this->mediaInfoParser = parent::getParser($type, $filePath, $taskConfig, $job);
$this->partnerId = $job->partnerId;
DbManager::setConfig(kConf::getDB());
DbManager::initialize();
$fileSync = FileSyncPeer::retrieveByWamsAssetId($this->wamsAssetId);
if ($fileSync) {
$flavorAsset = kFileSyncUtils::retrieveObjectForFileSync($fileSync);
if ($flavorAsset instanceof asset) {
$this->originalMediaInfo = mediaInfoPeer::retrieveOriginalByEntryId($flavorAsset->getEntryId());
$entry = $flavorAsset->getentry();
if ($entry) {
$this->mediaType = $entry->getMediaType();
}
}
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:26,代码来源:KWAMSMediaInfoParser.php
示例16: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
requestUtils::handleConditionalGet();
$file_sync_id = $this->getRequestParameter("id");
$hash = $this->getRequestParameter("hash");
$file_name = $this->getRequestParameter("fileName");
if ($file_name) {
$file_name = base64_decode($file_name);
}
$file_sync = FileSyncPeer::retrieveByPk($file_sync_id);
if (!$file_sync) {
$current_dc_id = kDataCenterMgr::getCurrentDcId();
$error = "DC[{$current_dc_id}]: Cannot find FileSync with id [{$file_sync_id}]";
KalturaLog::err($error);
KExternalErrors::dieError(KExternalErrors::FILE_NOT_FOUND);
}
KalturaMonitorClient::initApiMonitor(false, 'extwidget.serveFile', $file_sync->getPartnerId());
kDataCenterMgr::serveFileToRemoteDataCenter($file_sync, $hash, $file_name);
die;
}
开发者ID:DBezemer,项目名称:server,代码行数:23,代码来源:servefileAction.class.php
示例17: validateForUsage
public function validateForUsage($sourceObject, $propertiesToSkip = array())
{
parent::validateForUsage($sourceObject, $propertiesToSkip);
$this->validatePropertyNotNull('assetId');
$srcFlavorAsset = assetPeer::retrieveById($this->assetId);
if (!$srcFlavorAsset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $resource->assetId);
}
$key = $srcFlavorAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->addAnd(FileSyncPeer::FILE_TYPE, array(FileSync::FILE_SYNC_FILE_TYPE_FILE, FileSync::FILE_SYNC_FILE_TYPE_LINK), Criteria::IN);
$fileSyncs = FileSyncPeer::doSelect($c);
foreach ($fileSyncs as $fileSync) {
$fileSync = kFileSyncUtils::resolve($fileSync);
if ($fileSync->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_FILE) {
return;
}
}
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
开发者ID:DBezemer,项目名称:server,代码行数:20,代码来源:KalturaAssetResource.php
示例18: getExclusiveFileSyncImportJobsAction
/**
* batch getExclusiveFileSyncImportJob action allows to get a BatchJob of type FILESYNC_IMPORT
*
* @action getExclusiveFileSyncImportJobs
* @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism
* @param int $maxExecutionTime The maximum time in seconds the job reguarly take. Is used for the locking mechanism when determining an unexpected termination of a batch-process.
* @param int $numberOfJobs The maximum number of jobs to return.
* @param KalturaBatchJobFilter $filter Set of rules to fetch only rartial list of jobs
* @return KalturaBatchJobArray
*/
function getExclusiveFileSyncImportJobsAction(KalturaExclusiveLockKey $lockKey, $maxExecutionTime, $numberOfJobs, KalturaBatchJobFilter $filter = null)
{
$jobs = $this->getExclusiveJobsAction($lockKey, $maxExecutionTime, $numberOfJobs, $filter, BatchJobType::FILESYNC_IMPORT);
if ($jobs) {
foreach ($jobs as $job) {
$data = $job->data;
// try to get destination path from file sync
$fileSyncId = $data->filesyncId;
$fileSync = FileSyncPeer::retrieveByPK($fileSyncId);
if (!$fileSync) {
throw new KalturaAPIException(MultiCentersErrors::INVALID_FILESYNC_RECORD, $fileSyncId);
}
$fileSyncRoot = $fileSync->getFileRoot();
$fileSyncPath = $fileSync->getFilePath();
if ($fileSyncRoot && $fileSyncPath) {
// destination path set on filesync
$dest_path = $fileSyncRoot . $fileSyncPath;
} else {
// not set on filesync - get path from path manager
$fileSyncKey = kFileSyncUtils::getKeyForFileSync($fileSync);
list($file_root, $real_path) = kPathManager::getFilePathArr($fileSyncKey);
$dest_path = $file_root . $real_path;
// update filesync on database
$fileSync->setFileRoot($file_root);
$fileSync->setFilePath($real_path);
$fileSync->save();
}
// update job data with destination path if needed
if (!$data->destFilePath) {
$data->destFilePath = $dest_path;
$job->data = $data;
KalturaLog::log('Updating destination path for job id [$job->id]');
$this->updateJob($job);
}
if (!is_dir(dirname($dest_path)) && !@mkdir(dirname($dest_path), 0755, true)) {
KalturaLog::ERR("Cannot create directory [{$dest_path}] - " . error_get_last());
}
}
}
return $jobs;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:51,代码来源:FileSyncImportBatchService.php
示例19: handleStorageExportFailed
/**
* @param BatchJob $dbBatchJob
* @param kStorageExportJobData $data
* @return BatchJob
*/
public static function handleStorageExportFailed(BatchJob $dbBatchJob, kStorageExportJobData $data)
{
KalturaLog::debug("Export to storage failed for sync file[" . $data->getSrcFileSyncId() . "]");
$fileSync = FileSyncPeer::retrieveByPK($data->getSrcFileSyncId());
$fileSync->setStatus(FileSync::FILE_SYNC_STATUS_ERROR);
$fileSync->save();
return $dbBatchJob;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:13,代码来源:kFlowHelper.php
示例20: isPendingExport
public function isPendingExport(asset $asset)
{
$key = $asset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$c = FileSyncPeer::getCriteriaForFileSyncKey($key);
$c->addAnd(FileSyncPeer::DC, $this->getId(), Criteria::EQUAL);
$fileSync = FileSyncPeer::doSelectOne($c);
if (!$fileSync) {
return false;
}
return $fileSync->getStatus() == FileSync::FILE_SYNC_STATUS_PENDING;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:11,代码来源:StorageProfile.php
注:本文中的FileSyncPeer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论