本文整理汇总了PHP中BatchJobPeer类的典型用法代码示例。如果您正苦于以下问题:PHP BatchJobPeer类的具体用法?PHP BatchJobPeer怎么用?PHP BatchJobPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BatchJobPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
}
示例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);
}
示例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));
}
示例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);
}
}
示例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
}
示例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);
}
示例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}");
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}