本文整理汇总了PHP中BatchJobPeer类的典型用法代码示例。如果您正苦于以下问题:PHP BatchJobPeer类的具体用法?PHP BatchJobPeer怎么用?PHP BatchJobPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BatchJobPeer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$limit = $this->getP("page_size", 20);
$limit = min($limit, 100);
$page = $this->getP("page", 1);
$offset = ($page - 1) * $limit;
$c = new Criteria();
$c->addAnd(BatchJobPeer::PARTNER_ID, $partner_id);
$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
$c->addDescendingOrderByColumn(BatchJobPeer::ID);
$count = BatchJobPeer::doCount($c);
$c->setLimit($limit);
$c->setOffset($offset);
$jobs = BatchJobPeer::doSelect($c);
$obj = array();
foreach ($jobs as $job) {
$jobData = $job->getData();
if (!$jobData instanceof kBulkUploadJobData) {
continue;
}
$bulkResults = BulkUploadResultPeer::retrieveWithEntryByBulkUploadId($job->getId());
$obj[] = array("uploadedBy" => $jobData->getUploadedBy(), "uploadedOn" => $job->getCreatedAt(null), "numOfEntries" => count($bulkResults), "status" => $job->getStatus(), "error" => $job->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED ? $job->getMessage() : '', "logFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/log", "csvFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/csv");
}
$this->addMsg("count", $count);
$this->addMsg("page_size", $limit);
$this->addMsg("page", $page);
$this->addMsg("bulk_uploads", $obj);
}
开发者ID:DBezemer,项目名称:server,代码行数:28,代码来源:listbulkuploadsAction.class.php
示例2: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
// TODO - verify permissions for viewing lists
$detailed = $this->getP("detailed", false);
$limit = $this->getP("page_size", 10);
$page = $this->getP("page", 1);
//$order_by = int( $this->getP ( "order_by" , -1 ) );
$offset = ($page - 1) * $limit;
$c = new Criteria();
$download_types = array(BatchJobType::FLATTEN, BatchJobType::DOWNLOAD);
$c->add(BatchJobPeer::JOB_TYPE, $download_types, Criteria::IN);
// filter
$filter = new BatchJobFilter(true);
$fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
$filter->attachToCriteria($c);
//if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
$count = BatchJobPeer::doCount($c);
$offset = ($page - 1) * $limit;
$c->setLimit($limit);
if ($offset > 0) {
$c->setOffset($offset);
}
$list = BatchJobPeer::doSelect($c);
$level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
$this->addMsg("count", $count);
$this->addMsg("page_size", $limit);
$this->addMsg("page", $page);
$wrapper = objectWrapperBase::getWrapperClass($list, $level);
$this->addMsg("downloads", $wrapper);
}
开发者ID:DBezemer,项目名称:server,代码行数:30,代码来源:listdownloadsAction.class.php
示例3: getClientNotificationAction
/**
* Return the notifications for a specific entry id and type
*
* @action getClientNotification
* @param string $entryId
* @param KalturaNotificationType $type
* @return KalturaClientNotification
*/
function getClientNotificationAction($entryId, $type)
{
// in case of a multirequest, a mediaService.addFromUploadedFile may fail and therefore the resulting entry id will be empty
// in such a case return immidiately without looking for the notification
if ($entryId == '') {
throw new KalturaAPIException(KalturaErrors::NOTIFICATION_FOR_ENTRY_NOT_FOUND, $entryId);
}
$notifications = BatchJobPeer::retrieveByEntryIdAndType($entryId, BatchJobType::NOTIFICATION, $type);
// FIXME: throw error if not found
if (count($notifications) == 0) {
throw new KalturaAPIException(KalturaErrors::NOTIFICATION_FOR_ENTRY_NOT_FOUND, $entryId);
}
$notification = $notifications[0];
$partnerId = $this->getPartnerId();
$nofication_config_str = null;
list($nofity, $nofication_config_str) = myPartnerUtils::shouldNotify($partnerId);
if (!$nofity) {
return new KalturaClientNotification();
}
$nofication_config = myNotificationsConfig::getInstance($nofication_config_str);
$nofity_send_type = $nofication_config->shouldNotify($type);
if ($nofity_send_type != myNotificationMgr::NOTIFICATION_MGR_SEND_SYNCH && $nofity_send_type != myNotificationMgr::NOTIFICATION_MGR_SEND_BOTH) {
return new KalturaClientNotification();
}
$partner = PartnerPeer::retrieveByPK($partnerId);
list($url, $signatureKey) = myNotificationMgr::getPartnerNotificationInfo($partner);
list($params, $rawSignature) = myNotificationMgr::prepareNotificationData($url, $signatureKey, $notification, null);
$serializedParams = http_build_query($params, "", "&");
$result = new KalturaClientNotification();
$result->url = $url;
$result->data = $serializedParams;
return $result;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:41,代码来源:NotificationService.php
示例4: copyModifiedColumns
protected function copyModifiedColumns(BatchJobLog $batchJobLog, BatchJob $batchJob, array $modifiedColumns)
{
$shouldSkipInTranslation = array(BatchJobPeer::LOCK_INFO, BatchJobPeer::HISTORY, BatchJobPeer::BATCH_JOB_LOCK_ID, BatchJobPeer::EXECUTION_STATUS);
foreach ($modifiedColumns as $modifiedColumn) {
$fieldPosLog = -1;
try {
if (in_array($modifiedColumn, $shouldSkipInTranslation)) {
if ($modifiedColumn == BatchJobPeer::EXECUTION_STATUS) {
$batchJobLog->setAbort($batchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED);
}
continue;
}
$fieldName = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME);
$fieldPosJob = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_NUM);
$fieldPosLog = BatchJobLogPeer::translateFieldName($fieldName, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM);
} catch (PropelException $e) {
KalturaLog::err("Could not set value for BatchJobLog field {$fieldName}, exception thrown: " . $e->getMessage());
}
if ($fieldPosLog != -1) {
$batchJobLog->setByPosition($fieldPosLog, $batchJob->getByPosition($fieldPosJob));
}
if ($modifiedColumn == BatchJobPeer::DATA) {
//set param_1 for the $batchJobLog
$batchJobData = $batchJob->getData();
/* @var $batchJobData kBulkUploadJobData */
$batchJobLog->setParam1($batchJobData->getBulkUploadObjectType());
}
}
return $batchJobLog;
}
开发者ID:DBezemer,项目名称:server,代码行数:30,代码来源:kBatchJobLogManager.php
示例5: 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
示例6: notifyAction
/**
* @action notify
* @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
* @param int $id integration job id
*/
public function notifyAction($id)
{
$coreType = IntegrationPlugin::getBatchJobTypeCoreValue(IntegrationBatchJobType::INTEGRATION);
$batchJob = BatchJobPeer::retrieveByPK($id);
$invalidJobId = false;
$invalidKs = false;
if (!self::validateKs($batchJob)) {
$invalidKs = true;
KalturaLog::err("ks not valid for notifying job [{$id}]");
} elseif (!$batchJob) {
$invalidJobId = true;
KalturaLog::err("Job [{$id}] not found");
} elseif ($batchJob->getJobType() != $coreType) {
$invalidJobId = true;
KalturaLog::err("Job [{$id}] wrong type [" . $batchJob->getJobType() . "] expected [" . $coreType . "]");
} elseif ($batchJob->getStatus() != KalturaBatchJobStatus::ALMOST_DONE) {
$invalidJobId = true;
KalturaLog::err("Job [{$id}] wrong status [" . $batchJob->getStatus() . "] expected [" . KalturaBatchJobStatus::ALMOST_DONE . "]");
} elseif ($batchJob->getPartnerId() != kCurrentContext::getCurrentPartnerId()) {
$invalidKs = true;
KalturaLog::err("Job [{$id}] of wrong partner [" . $batchJob->getPartnerId() . "] expected [" . kCurrentContext::getCurrentPartnerId() . "]");
}
if ($invalidJobId) {
throw new KalturaAPIException(KalturaErrors::INVALID_BATCHJOB_ID, $id);
}
if ($invalidKs) {
throw new KalturaAPIException(KalturaIntegrationErrors::INTEGRATION_NOTIFY_FAILED);
}
kJobsManager::updateBatchJob($batchJob, KalturaBatchJobStatus::FINISHED);
}
开发者ID:DBezemer,项目名称:server,代码行数:35,代码来源:IntegrationService.php
示例7: getLockedJobs
public function getLockedJobs()
{
$c = new Criteria();
$c->add(BatchJobPeer::BATCH_INDEX, null, Criteria::ISNOTNULL);
$c->add(BatchJobPeer::SCHEDULER_ID, $this->scheduler_configured_id);
$c->add(BatchJobPeer::WORKER_ID, $this->configured_id);
return BatchJobPeer::doSelect($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:8,代码来源:SchedulerWorker.php
示例8: getFieldNameFromPeer
public function getFieldNameFromPeer($field_name)
{
if ($this->queryFromBatchJob) {
return BatchJobPeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME);
} else {
return BatchJobLockPeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME);
}
}
开发者ID:DBezemer,项目名称:server,代码行数:8,代码来源:BatchJobFilter.class.php
示例9: execute
public function execute()
{
$jobId = $this->getRequestParameter("id");
$partnerId = $this->getRequestParameter("pid");
$type = $this->getRequestParameter("type");
$c = new Criteria();
$c->addAnd(BatchJobPeer::ID, $jobId);
$c->addAnd(BatchJobPeer::PARTNER_ID, $partnerId);
$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
$batchJob = BatchJobPeer::doSelectOne($c);
if (!$batchJob) {
die("File not found");
}
header("Content-Type: text/plain; charset=UTF-8");
if ($type == "log") {
$bulkUploadResults = BulkUploadResultPeer::retrieveByBulkUploadId($jobId);
if (!count($bulkUploadResults)) {
$syncKey = $batchJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADLOG);
if (kFileSyncUtils::file_exists($syncKey, true)) {
$content = kFileSyncUtils::file_get_contents($syncKey, true);
echo $content;
die;
}
die("Log file is not ready");
}
$STDOUT = fopen('php://output', 'w');
$data = $batchJob->getData();
foreach ($bulkUploadResults as $bulkUploadResult) {
$values = array($bulkUploadResult->getTitle(), $bulkUploadResult->getDescription(), $bulkUploadResult->getTags(), $bulkUploadResult->getUrl(), $bulkUploadResult->getContentType());
if ($data instanceof kBulkUploadJobData && $data->getCsvVersion() > kBulkUploadJobData::BULK_UPLOAD_CSV_VERSION_V1) {
$values[] = $bulkUploadResult->getConversionProfileId();
$values[] = $bulkUploadResult->getAccessControlProfileId();
$values[] = $bulkUploadResult->getCategory();
$values[] = $bulkUploadResult->getScheduleStartDate('Y-m-d\\TH:i:s');
$values[] = $bulkUploadResult->getScheduleEndDate('Y-m-d\\TH:i:s');
$values[] = $bulkUploadResult->getThumbnailUrl();
$values[] = $bulkUploadResult->getPartnerData();
}
$values[] = $bulkUploadResult->getEntryId();
$values[] = $bulkUploadResult->getEntryStatus();
$values[] = $bulkUploadResult->getErrorDescription();
fputcsv($STDOUT, $values);
}
fclose($STDOUT);
} else {
$syncKey = $batchJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADCSV);
if (kFileSyncUtils::file_exists($syncKey, true)) {
$content = kFileSyncUtils::file_get_contents($syncKey, true);
echo $content;
die;
} else {
die("File not found");
}
}
die;
// no template needed
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:57,代码来源:bulkuploadfileAction.class.php
示例10: updateExclusiveFileSyncImportJobAction
/**
* batch updateExclusiveFileSyncImportJob action updates a BatchJob of type FILESYNC_IMPORT that was claimed using the getExclusiveFileSyncImportJobs
*
* @action updateExclusiveFileSyncImportJob
* @param int $id The id of the job to free
* @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism
* @param KalturaBatchJob $job
* @return KalturaBatchJob
*/
function updateExclusiveFileSyncImportJobAction($id, KalturaExclusiveLockKey $lockKey, KalturaBatchJob $job)
{
$dbBatchJob = BatchJobPeer::retrieveByPK($id);
// verifies that the job is of the right type
if ($dbBatchJob->getJobType() != KalturaBatchJobType::FILESYNC_IMPORT) {
throw new KalturaAPIException(APIErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE, $id, serialize($lockKey), serialize($job));
}
$dbBatchJob = kBatchManager::updateExclusiveBatchJob($id, $lockKey->toObject(), $job->toObject($dbBatchJob));
$batchJob = new KalturaBatchJob();
// start from blank
return $batchJob->fromObject($dbBatchJob);
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:21,代码来源:FileSyncImportBatchService.php
示例11: execute
/**
* Will investigate a single entry
*/
public function execute()
{
$this->forceSystemAuthentication();
$batchjob_id = @$_REQUEST["batchjob_id"];
$entry_id = @$_REQUEST["entry_id"];
$job = BatchJobPeer::retrieveByPK($batchjob_id);
if ($job) {
$job->setStatus(BatchJob::BATCHJOB_STATUS_PENDING);
$job->save();
}
$this->redirect("/system/investigate?entry_id={$entry_id}");
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:15,代码来源:restartJobAction.class.php
示例12: updateExclusiveVirusScanJobAction
/**
* batch updateExclusiveVirusScanJob action updates a BatchJob of type VIRUS_SCAN that was claimed using the getExclusiveVirusScanJobs
*
* @action updateExclusiveVirusScanJob
* @param int $id The id of the job to free
* @param KalturaExclusiveLockKey $lockKey The unique lock key from the batch-process. Is used for the locking mechanism
* @param KalturaBatchJob $job
* @return KalturaBatchJob
*/
function updateExclusiveVirusScanJobAction($id, KalturaExclusiveLockKey $lockKey, KalturaBatchJob $job)
{
$dbBatchJob = BatchJobPeer::retrieveByPK($id);
// verifies that the job is of the right type
$jobType = VirusScanPlugin::getBatchJobTypeCoreValue(VirusScanBatchJobType::VIRUS_SCAN);
if ($dbBatchJob->getJobType() != $jobType) {
throw new KalturaAPIException(APIErrors::UPDATE_EXCLUSIVE_JOB_WRONG_TYPE, $id, serialize($lockKey), serialize($job));
}
$dbBatchJob = kBatchManager::updateExclusiveBatchJob($id, $lockKey->toObject(), $job->toObject($dbBatchJob));
$batchJob = new KalturaBatchJob();
// start from blank
return $batchJob->fromObject($dbBatchJob);
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:22,代码来源:VirusScanBatchService.php
示例13: retrieveObject
/**
*
* @param int $objectType
* @param string $objectId
* @return ISyncableFile
*/
public static function retrieveObject($objectType, $objectId)
{
$object = null;
switch ($objectType) {
case FileSyncObjectType::ENTRY:
entryPeer::setUseCriteriaFilter(false);
$object = entryPeer::retrieveByPK($objectId);
entryPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::UICONF:
uiConfPeer::setUseCriteriaFilter(false);
$object = uiConfPeer::retrieveByPK($objectId);
uiConfPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::BATCHJOB:
BatchJobPeer::setUseCriteriaFilter(false);
$object = BatchJobPeer::retrieveByPK($objectId);
BatchJobPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::FLAVOR_ASSET:
assetPeer::setUseCriteriaFilter(false);
$object = assetPeer::retrieveById($objectId);
assetPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::SYNDICATION_FEED:
syndicationFeedPeer::setUseCriteriaFilter(false);
$object = syndicationFeedPeer::retrieveByPK($objectId);
syndicationFeedPeer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::CONVERSION_PROFILE:
conversionProfile2Peer::setUseCriteriaFilter(false);
$object = conversionProfile2Peer::retrieveByPK($objectId);
conversionProfile2Peer::setUseCriteriaFilter(true);
break;
case FileSyncObjectType::FILE_ASSET:
conversionProfile2Peer::setUseCriteriaFilter(false);
$object = FileAssetPeer::retrieveByPK($objectId);
conversionProfile2Peer::setUseCriteriaFilter(true);
break;
}
if ($object == null) {
$object = KalturaPluginManager::loadObject('ISyncableFile', $objectType, array('objectId' => $objectId));
}
if ($object == null) {
$error = __METHOD__ . " Cannot find object type [" . $objectType . "] with object_id [" . $objectId . "]";
KalturaLog::err($error);
throw new kFileSyncException($error);
}
return $object;
}
开发者ID:DBezemer,项目名称:server,代码行数:56,代码来源:kFileSyncObjectManager.php
示例14: setData
/**
* @param boolean $bypassSerialization enables PS2 support
*/
public function setData($v, $bypassSerialization = false)
{
if ($bypassSerialization) {
return parent::setData($v);
}
$this->setDuplicationKey(BatchJobPeer::createDuplicationKey($this->getJobType(), $v));
if (!is_null($v)) {
$sereializedValue = serialize($v);
if (strlen((string) $sereializedValue) > BatchJob::MAX_SERIALIZED_JOB_DATA_SIZE) {
$v = new kJobCompressedData($sereializedValue);
$sereializedValue = serialize($v);
}
parent::setData($sereializedValue);
} else {
parent::setData(null);
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:20,代码来源:BatchJobLog.php
示例15: getEntryId
public function getEntryId(FileSync $fileSync)
{
if ($fileSync->getObjectType() == FileSyncObjectType::ENTRY) {
return $fileSync->getObjectId();
}
if ($fileSync->getObjectType() == FileSyncObjectType::BATCHJOB) {
$job = BatchJobPeer::retrieveByPK($fileSync->getObjectId());
if ($job) {
return $job->getEntryId();
}
}
if ($fileSync->getObjectType() == FileSyncObjectType::FLAVOR_ASSET) {
$flavor = flavorAssetPeer::retrieveById($fileSync->getObjectId());
if ($flavor) {
return $flavor->getEntryId();
}
}
return null;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:19,代码来源:kMultiCentersSynchronizer.php
示例16: copyModifiedColumns
protected function copyModifiedColumns(BatchJobLog $batchJobLog, BatchJob $batchJob, array $modifiedColumns)
{
foreach ($modifiedColumns as $modifiedColumn) {
try {
$fieldName = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME);
$fieldPosJob = BatchJobPeer::translateFieldName($modifiedColumn, BasePeer::TYPE_COLNAME, BasePeer::TYPE_NUM);
$fieldPosLog = BatchJobLogPeer::translateFieldName($fieldName, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM);
} catch (PropelException $e) {
KalturaLog::err("Could not set value for BatchJobLog field {$fieldName}, exception thrown: " . $e->getMessage());
}
$batchJobLog->setByPosition($fieldPosLog, $batchJob->getByPosition($fieldPosJob));
if ($modifiedColumn == BatchJobPeer::DATA) {
//set param_1 for the $batchJobLog
$batchJobData = $batchJob->getData();
/* @var $batchJobData kBulkUploadJobData */
$batchJobLog->setParam1($batchJobData->getBulkUploadObjectType());
}
}
return $batchJobLog;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:20,代码来源:kBatchJobLogManager.php
示例17: notifyAction
/**
* @action notify
* @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
* @param int $id integration job id
*/
public function notifyAction($id)
{
$coreType = IntegrationPlugin::getBatchJobTypeCoreValue(IntegrationBatchJobType::INTEGRATION);
$batchJob = BatchJobPeer::retrieveByPK($id);
$invalid = false;
if (!$batchJob) {
$invalid = true;
KalturaLog::err("Job [{$id}] not found");
} elseif ($batchJob->getJobType() != $coreType) {
$invalid = true;
KalturaLog::err("Job [{$id}] wrong type [" . $batchJob->getJobType() . "] expected [" . $coreType . "]");
} elseif ($batchJob->getStatus() != KalturaBatchJobStatus::ALMOST_DONE) {
$invalid = true;
KalturaLog::err("Job [{$id}] wrong status [" . $batchJob->getStatus() . "] expected [" . KalturaBatchJobStatus::ALMOST_DONE . "]");
}
if ($invalid) {
throw new KalturaAPIException(KalturaErrors::INVALID_BATCHJOB_ID, $id);
}
kJobsManager::updateBatchJob($batchJob, KalturaBatchJobStatus::FINISHED);
}
开发者ID:visomar,项目名称:server,代码行数:25,代码来源:IntegrationService.php
示例18: notifyAction
/**
* @action notify
* @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
* @param int $id distribution job id
*/
public function notifyAction($id)
{
$submitCoreType = ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT);
$updateCoreType = ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE);
$deleteCoreType = ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE);
$validJobTypes = array($submitCoreType, $updateCoreType, $deleteCoreType);
$batchJob = BatchJobPeer::retrieveByPK($id);
$invalid = false;
if (!$batchJob) {
$invalid = true;
KalturaLog::err("Job [{$id}] not found");
} elseif (!in_array($batchJob->getJobType(), $validJobTypes)) {
$invalid = true;
KalturaLog::err("Job [{$id}] wrong type [" . $batchJob->getJobType() . "] expected [" . implode(', ', $validJobTypes) . "]");
} elseif ($batchJob->getJobSubType() != UnicornDistributionProvider::get()->getType()) {
$invalid = true;
KalturaLog::err("Job [{$id}] wrong sub-type [" . $batchJob->getJobSubType() . "] expected [" . UnicornDistributionProvider::get()->getType() . "]");
} elseif ($batchJob->getStatus() != KalturaBatchJobStatus::ALMOST_DONE) {
$invalid = true;
KalturaLog::err("Job [{$id}] wrong status [" . $batchJob->getStatus() . "] expected [" . KalturaBatchJobStatus::ALMOST_DONE . "]");
}
if ($invalid) {
throw new KalturaAPIException(KalturaErrors::INVALID_BATCHJOB_ID, $id);
}
kJobsManager::updateBatchJob($batchJob, KalturaBatchJobStatus::FINISHED);
$data = $batchJob->getData();
/* @var $data kDistributionJobData */
$providerData = $data->getProviderData();
/* @var $providerData kUnicornDistributionJobProviderData */
$entryDistribution = EntryDistributionPeer::retrieveByPK($data->getEntryDistributionId());
if ($entryDistribution) {
$entryDistribution->putInCustomData(kUnicornDistributionJobProviderData::CUSTOM_DATA_FLAVOR_ASSET_OLD_VERSION, $providerData->getFlavorAssetVersion());
$entryDistribution->save();
}
if ($batchJob->getJobType() == $submitCoreType) {
$this->attachRemoteAssetResource($batchJob->getEntry(), $batchJob->getData());
}
if ($batchJob->getJobType() == $deleteCoreType) {
$this->detachRemoteAssetResource($batchJob->getEntry(), $batchJob->getData());
}
}
开发者ID:DBezemer,项目名称:server,代码行数:46,代码来源:UnicornService.php
示例19: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$job_type = $this->getPM("job_type");
$processor_name = $this->getPM("processor_name");
$processor_timeout = $this->getPM("processor_timeout");
$over_quota_partners = $this->getPM("over_quota_partners");
$defered_partners = $this->getPM("defered_partners");
$con = Propel::getConnection();
// fetch one pending row of a given job_type
// where the over_quota_partner requests are dropped
// and defered_partners request are of less priority
$query = "SELECT " . BatchJobPeer::ID . " FROM " . BatchJobPeer::TABLE_NAME . " WHERE " . BatchJobPeer::STATUS . "=" . BatchJob::BATCHJOB_STATUS_PENDING . " AND " . BatchJobPeer::JOB_TYPE . "=" . $job_type . " " . (count($over_quota_partners) ? " AND " . BatchJobPeer::PARTNER_ID . " NOT IN ({$over_quota_partners}) " : "") . " ORDER BY " . (count($defered_partners) ? BatchJobPeer::PARTNER_ID . " IN ({$defered_partners}), " : "") . BatchJobPeer::CREATED_AT . " LIMIT 1";
$statement = $con->prepareStatement($query);
$resultset = $statement->executeQuery();
$batch_job = null;
while ($resultset->next()) {
$batch_job = BatchJobPeer::retrieveByPK($resultset->getInt('ID'));
}
$batch_job = BatchJobPeer::doSelectOne($c);
if ($batch_job) {
// force update to work on the currently selected row and ensure it is still in pending status
$c->add(BatchJobPeer::ID, $batch_job->getId());
$c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_PENDING);
$update = new Criteria();
$update->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_QUEUED);
$update->add(BatchJobPeer::PROCESSOR_NAME, $processor_name);
$update->add(BatchJobPeer::PROCESSOR_EXPIRATION, time() + $processor_timeout);
$affectedRows = BasePeer::doUpdate($c, $update, $con);
if ($affectedRows != 1) {
$batch_job = null;
}
}
if (!$batch_job) {
//xx$this->addError ( APIErrors::INVALID_ENTRY_ID, $this->getObjectPrefix() , $entry_id );
} else {
$wrapper = objectWrapperBase::getWrapperClass($batch_job, objectWrapperBase::DETAIL_LEVEL_REGULAR);
// TODO - remove this code when cache works properly when saving objects (in their save method)
$wrapper->removeFromCache("batch_job", $batch_job->getId());
$this->addMsg("batchjob", $wrapper);
}
}
开发者ID:DBezemer,项目名称:server,代码行数:41,代码来源:queuependingbatchjobAction.class.php
示例20: execute
/**
* Will list out all kind of perspectives of entries
*/
public function execute()
{
$this->forceSystemAuthentication();
$conversion_count = $this->getRequestParameter("conv_count", 10);
if ($conversion_count > 40) {
$conversion_count = 40;
}
$c = new Criteria();
$c->addDescendingOrderByColumn(conversionPeer::ID);
$c->setLimit($conversion_count);
$this->conversions = conversionPeer::doSelect($c);
$this->conversion_count = $conversion_count;
/*
$conv = new conversion();
$conv->setId(6);
$conv->setinFileName ( "Dasd");
$conv->setStatus ( 1 );
$conv->setCreatedAt ( 1234545 );
$convs = array ( $conv );
$this->conversions = $convs;
*/
$import_count = $this->getRequestParameter("impo_count", 10);
if ($import_count > 40) {
$import_count = 40;
}
$c = new Criteria();
$c->addDescendingOrderByColumn(BatchJobPeer::ID);
$c->setLimit($import_count);
$this->imports = BatchJobPeer::doSelect($c);
$this->import_count = $import_count;
/*
$batch= new BatchJob();
$batch->setId ( 4 );
$batch->setData ( 'a:3:{s:7:"entryId";i:11077;s:9:"sourceUrl";s:84:"http://youtube.com/get_video?video_id=KDko2MFvY-s&t=OEgsToPDskKuVircfOJDjTh4FENGwQ0g";s:8:"destFile";s:36:"/web//content/imports/data/11077.flv";}' );
$imports = array( $batch );
$this->imports = $imports;
*/
}
开发者ID:DBezemer,项目名称:server,代码行数:42,代码来源:entrydashAction.class.php
注:本文中的BatchJobPeer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论